diff --git a/kernel/proc.c b/kernel/proc.c index ef2ad68..0cb5afe 100644 --- a/kernel/proc.c +++ b/kernel/proc.c @@ -176,8 +176,7 @@ proc_freepagetable(pagetable_t pagetable, uint64 sz) { uvmunmap(pagetable, TRAMPOLINE, PGSIZE, 0); uvmunmap(pagetable, TRAPFRAME, PGSIZE, 0); - if(sz > 0) - uvmfree(pagetable, sz); + uvmfree(pagetable, sz); } // a user program that calls exec("/init") diff --git a/kernel/vm.c b/kernel/vm.c index c5da0c1..3004bb3 100644 --- a/kernel/vm.c +++ b/kernel/vm.c @@ -301,7 +301,8 @@ freewalk(pagetable_t pagetable) void uvmfree(pagetable_t pagetable, uint64 sz) { - uvmunmap(pagetable, 0, sz, 1); + if(sz > 0) + uvmunmap(pagetable, 0, sz, 1); freewalk(pagetable); }