diff options
author | Waldemar Brodkorb <wbx@openadk.org> | 2015-01-26 11:22:42 -0600 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2015-01-26 11:22:42 -0600 |
commit | f03fbbb009c0df52d363719a592e2ac33577d9a6 (patch) | |
tree | 01671bcc5099ef304faf5ae86d58bbf32f9d0b7c /libc/stdlib/malloc-simple/alloc.c | |
parent | 97dc8cb71d96a4bbfda0aa51740433d5da825b6a (diff) | |
parent | 92de8a5f6ffb1ff9f7183fd08d872aa098b75ae2 (diff) |
merge upstream changes
Diffstat (limited to 'libc/stdlib/malloc-simple/alloc.c')
-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)); } |