diff options
author | Rich Felker <dalias@aerifal.cx> | 2013-10-05 11:59:21 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2013-10-05 11:59:21 -0400 |
commit | a947d317a2769d90bdb19aa11942b7a0680051d5 (patch) | |
tree | d596eff6c40fd3ef448d5bee745ac0039d693033 /src/malloc | |
parent | 543787039098c121917cb5f3e129d84b61afa61b (diff) | |
download | musl-a947d317a2769d90bdb19aa11942b7a0680051d5.zip musl-a947d317a2769d90bdb19aa11942b7a0680051d5.tar.gz musl-a947d317a2769d90bdb19aa11942b7a0680051d5.tar.bz2 |
fix failure of malloc to set errno on heap (brk) exhaustion
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.
Diffstat (limited to 'src/malloc')
-rw-r--r-- | src/malloc/malloc.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/malloc/malloc.c b/src/malloc/malloc.c index fb65ab5..d6ad904 100644 --- 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; } |