mirror of
https://github.com/fluencelabs/musl
synced 2025-06-14 15:31:42 +00:00
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.
This commit is contained in:
@ -177,6 +177,7 @@ static struct chunk *expand_heap(size_t n)
|
|||||||
return w;
|
return w;
|
||||||
fail:
|
fail:
|
||||||
unlock(mal.brk_lock);
|
unlock(mal.brk_lock);
|
||||||
|
errno = ENOMEM;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user