projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5437870
)
fix failure of malloc to set errno on heap (brk) exhaustion
author
Rich Felker
<dalias@aerifal.cx>
Sat, 5 Oct 2013 15:59:21 +0000
(11:59 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Sat, 5 Oct 2013 15:59:21 +0000
(11:59 -0400)
I wrongly assumed the brk syscall would set errno, but on failure it
returns the old value of the brk rather than an error code.
src/malloc/malloc.c
patch
|
blob
|
history
diff --git
a/src/malloc/malloc.c
b/src/malloc/malloc.c
index fb65ab5bb180416166c94c8eca84d6567507dd4f..d6ad90414fc799f861ed58500d56b62b611ffa6e 100644
(file)
--- a/
src/malloc/malloc.c
+++ b/
src/malloc/malloc.c
@@
-177,6
+177,7
@@
static struct chunk *expand_heap(size_t n)
return w;
fail:
unlock(mal.brk_lock);
+ errno = ENOMEM;
return 0;
}