grep: error if sbrk fails
This commit is contained in:
parent
5510488879
commit
29b6ad3330
1 changed files with 4 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue