summaryrefslogtreecommitdiff
path: root/libc/stdlib
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-02-22 02:02:58 +0000
committerMike Frysinger <vapier@gentoo.org>2006-02-22 02:02:58 +0000
commit31ff6e059f6473891d90d2ebe7548fe77b85717a (patch)
tree3cc92d41b2948c93daf57dc2fe4b037b97630b2d /libc/stdlib
parent1bfe52d8ef77de5e86d493d7544a7bb82de74829 (diff)
check for a 0 size first, then check for a NULL pointer
Diffstat (limited to 'libc/stdlib')
-rw-r--r--libc/stdlib/malloc/realloc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libc/stdlib/malloc/realloc.c b/libc/stdlib/malloc/realloc.c
index 0cf83e2bd..4d56565aa 100644
--- a/libc/stdlib/malloc/realloc.c
+++ b/libc/stdlib/malloc/realloc.c
@@ -28,13 +28,13 @@ realloc (void *mem, size_t new_size)
char *base_mem;
/* Check for special cases. */
- if (! mem)
- return malloc (new_size);
if (! new_size)
{
free (mem);
return malloc (new_size);
}
+ if (! mem)
+ return malloc (new_size);
/* Normal realloc. */