grep: error if sbrk fails

This commit is contained in:
BurnZeZ 2019-11-21 16:44:41 +00:00
parent 5510488879
commit 29b6ad3330

View file

@ -11,10 +11,14 @@ mal(int n)
if(m < n) {
if(n > Nhunk) {
v = sbrk(n);
if(v == (void*)-1)
error("sbrk");
memset(v, 0, n);
return v;
}
s = sbrk(Nhunk);
if(s == (void*)-1)
error("sbrk");
m = Nhunk;
}
v = s;