diff options
Diffstat (limited to 'libc/stdlib/malloc/realloc.c')
-rw-r--r-- | libc/stdlib/malloc/realloc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libc/stdlib/malloc/realloc.c b/libc/stdlib/malloc/realloc.c index f19df8bde..f1b78fcbc 100644 --- a/libc/stdlib/malloc/realloc.c +++ b/libc/stdlib/malloc/realloc.c @@ -52,10 +52,10 @@ realloc (void *mem, size_t new_size) /* Our attempts to extend MEM in place failed, just allocate-and-copy. */ { - void *new_mem = malloc (new_size); + void *new_mem = malloc (new_size - MALLOC_HEADER_SIZE); if (new_mem) { - memcpy (new_mem, mem, size); + memcpy (new_mem, mem, size - MALLOC_HEADER_SIZE); free (mem); } mem = new_mem; |