diff options
-rw-r--r-- | libc/stdlib/malloc/realloc.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libc/stdlib/malloc/realloc.c b/libc/stdlib/malloc/realloc.c index 9e6f880fe..85392ae6a 100644 --- a/libc/stdlib/malloc/realloc.c +++ b/libc/stdlib/malloc/realloc.c @@ -26,12 +26,13 @@ realloc (void *mem, size_t new_size) char *base_mem; /* Check for special cases. */ - if (!mem) - return malloc(new_size); - if (!new_size) { + if (! mem) + return malloc (new_size); + if (! new_size) + { free (mem); - return (malloc(new_size)); - } + return malloc (new_size); + } /* Normal realloc. */ |