diff --git a/proc.c b/proc.c index a016cd4..cf982c1 100644 --- a/proc.c +++ b/proc.c @@ -49,16 +49,15 @@ allocproc(void) int growproc(int n) { - char *newmem, *oldmem; + char *newmem; newmem = kalloc(cp->sz + n); if(newmem == 0) return -1; memmove(newmem, cp->mem, cp->sz); memset(newmem + cp->sz, 0, n); - oldmem = cp->mem; + kfree(cp->mem, cp->sz); cp->mem = newmem; - kfree(oldmem, cp->sz); cp->sz += n; setupsegs(cp); return cp->sz - n;