summaryrefslogtreecommitdiff
path: root/libc/stdlib/malloc/malloc.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-01-23 09:05:34 +0000
committerEric Andersen <andersen@codepoet.org>2003-01-23 09:05:34 +0000
commita018fc556428d4e4c3579b1f36f9c0ee5e1cc2b9 (patch)
treecdbf8a641b6a455debec47ad842415d0295bf720 /libc/stdlib/malloc/malloc.c
parent98e763d441c2896f407813bf36a5ae1c3c4a0369 (diff)
Update malloc behavior on malloc(0) to be consistant with
malloc-930716 behavior, i.e. return a NULL.
Diffstat (limited to 'libc/stdlib/malloc/malloc.c')
-rw-r--r--libc/stdlib/malloc/malloc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libc/stdlib/malloc/malloc.c b/libc/stdlib/malloc/malloc.c
index 4466367ed..7bbd2726b 100644
--- a/libc/stdlib/malloc/malloc.c
+++ b/libc/stdlib/malloc/malloc.c
@@ -1,8 +1,8 @@
/*
* libc/stdlib/malloc/malloc.c -- malloc function
*
- * Copyright (C) 2002 NEC Corporation
- * Copyright (C) 2002 Miles Bader <miles@gnu.org>
+ * Copyright (C) 2002,03 NEC Electronics Corporation
+ * Copyright (C) 2002,03 Miles Bader <miles@gnu.org>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License. See the file COPYING.LIB in the main
@@ -184,5 +184,8 @@ malloc (size_t size)
__heap_check (&__malloc_heap, "malloc");
#endif
+ if (size == 0)
+ return 0;
+
return malloc_from_heap (size, &__malloc_heap);
}