1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00
2006-10-12  Richard Sandiford  <richard@codesourcery.com>
	[BZ #3352]
	* elf/dl-minimal.c (realloc): Let malloc() return a new pointer,
	and use memcpy() if it does.
This commit is contained in:
Ulrich Drepper
2006-10-12 21:52:54 +00:00
parent de932366d4
commit 90a0991a65
13 changed files with 35 additions and 29 deletions

View File

@ -128,13 +128,14 @@ free (void *ptr)
void * weak_function
realloc (void *ptr, size_t n)
{
void *new;
if (ptr == NULL)
return malloc (n);
assert (ptr == alloc_last_block);
size_t old_size = alloc_ptr - alloc_last_block;
alloc_ptr = alloc_last_block;
new = malloc (n);
assert (new == ptr);
void *new = malloc (n);
if (new != ptr)
memcpy (new, ptr, old_size);
return new;
}