Panic in sbrk if setheap hasn't been called yet. This is preferable to

a mysterious crash.

Sponsored by: Netflix
This commit is contained in:
imp 2017-12-15 23:16:47 +00:00
parent cbd72f6554
commit f67f1d6d70

View File

@ -52,6 +52,9 @@ sbrk(int incr)
{
char *ret;
if (heapbase == 0)
panic("No heap setup\n");
if ((heapsize + incr) <= maxheap) {
ret = (char *)heapbase + heapsize;
bzero(ret, incr);