summaryrefslogtreecommitdiff
path: root/libc/stdlib/malloc-simple
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2007-04-02 12:06:00 +0000
committerMike Frysinger <vapier@gentoo.org>2007-04-02 12:06:00 +0000
commitc9210d381426332b9af4e7b01086dcea1fd49d05 (patch)
tree838b5a9ae2bc6761e7d64cb481a47b98c433b426 /libc/stdlib/malloc-simple
parentb612121d0d4b220041b43e591c802a82e028e34d (diff)
POSIX requires that errno be set whenever 0 is returned by malloc()
Diffstat (limited to 'libc/stdlib/malloc-simple')
-rw-r--r--libc/stdlib/malloc-simple/alloc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libc/stdlib/malloc-simple/alloc.c b/libc/stdlib/malloc-simple/alloc.c
index 0b842076d..321f31932 100644
--- a/libc/stdlib/malloc-simple/alloc.c
+++ b/libc/stdlib/malloc-simple/alloc.c
@@ -32,7 +32,8 @@ void *malloc(size_t size)
size++;
#else
/* Some programs will call malloc (0). Lets be strict and return NULL */
- return 0;
+ __set_errno(ENOMEM);
+ return NULL;
#endif
}