summaryrefslogtreecommitdiff
path: root/usr/src/lib/libumem/common/malloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/lib/libumem/common/malloc.c')
-rw-r--r--usr/src/lib/libumem/common/malloc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr/src/lib/libumem/common/malloc.c b/usr/src/lib/libumem/common/malloc.c
index 41d394ff22..86c1b0fd0f 100644
--- a/usr/src/lib/libumem/common/malloc.c
+++ b/usr/src/lib/libumem/common/malloc.c
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -394,6 +394,11 @@ realloc(void *buf_arg, size_t newsize)
if (buf_arg == NULL)
return (malloc(newsize));
+ if (newsize == 0) {
+ free(buf_arg);
+ return (NULL);
+ }
+
/*
* get the old data size without freeing the buffer
*/