diff options
-rw-r--r-- | lib/libc/stdlib/malloc.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c index ce8769c2d172..ca18d56d64ba 100644 --- a/lib/libc/stdlib/malloc.c +++ b/lib/libc/stdlib/malloc.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id: malloc.c,v 1.43 1998/09/30 06:13:59 jb Exp $ + * $Id: malloc.c,v 1.44 1999/03/28 14:16:05 phk Exp $ * */ @@ -1081,6 +1081,8 @@ malloc(size_t size) THREAD_UNLOCK(); if (malloc_xmalloc && !r) wrterror("out of memory.\n"); + if (!r) + errno = ENOMEM; return (r); } @@ -1133,6 +1135,8 @@ realloc(void *ptr, size_t size) THREAD_UNLOCK(); if (malloc_xmalloc && !r) wrterror("out of memory.\n"); + if (!r) + errno = ENOMEM; return (r); } |