mirror of
https://github.com/cc65/cc65.git
synced 2025-04-02 09:29:35 +00:00
Fixed a bug
git-svn-id: svn://svn.cc65.org/cc65/trunk@128 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
7b32de4b95
commit
a992dd05a0
@ -62,7 +62,19 @@ void* realloc (void* block, size_t size)
|
||||
* room left. Try to allocate a new block and copy the data.
|
||||
*/
|
||||
if (newblock = malloc (size)) {
|
||||
memcpy (newblock, block, oldsize - 2);
|
||||
|
||||
/* Adjust the old size to the user visible portion */
|
||||
oldsize -= sizeof (unsigned);
|
||||
|
||||
/* If the new block is larger than the old one, copy the old
|
||||
* data only
|
||||
*/
|
||||
if (size > oldsize) {
|
||||
size = oldsize;
|
||||
}
|
||||
|
||||
/* Copy the block data */
|
||||
memcpy (newblock, block, size);
|
||||
free (block);
|
||||
}
|
||||
return newblock;
|
||||
@ -70,9 +82,3 @@ void* realloc (void* block, size_t size)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user