diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2015-01-19 22:49:10 +0100 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2015-01-22 11:39:24 +0100 |
commit | 920db6d3935c86aff1b4fd0096ce6b5e3605d20d (patch) | |
tree | 52a5bf033372732018de77d7bd243cb3304ee981 /libc/stdlib/malloc-simple | |
parent | 78b154a95b507c205241dd883396952e0dfbede7 (diff) |
libc: Avoid redundant setting of ENOMEM
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libc/stdlib/malloc-simple')
-rw-r--r-- | libc/stdlib/malloc-simple/alloc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libc/stdlib/malloc-simple/alloc.c b/libc/stdlib/malloc-simple/alloc.c index 14f384632..a3c068a5b 100644 --- a/libc/stdlib/malloc-simple/alloc.c +++ b/libc/stdlib/malloc-simple/alloc.c @@ -42,8 +42,10 @@ void *malloc(size_t size) result = mmap((void *) 0, size + sizeof(size_t), PROT_READ | PROT_WRITE, MMAP_FLAGS, 0, 0); - if (result == MAP_FAILED) + if (result == MAP_FAILED) { + __set_errno(ENOMEM); return 0; + } * (size_t *) result = size; return(result + sizeof(size_t)); } |