提交 a947d317 编写于 作者: R Rich Felker

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.
上级 54378703
......@@ -177,6 +177,7 @@ static struct chunk *expand_heap(size_t n)
return w;
fail:
unlock(mal.brk_lock);
errno = ENOMEM;
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册