fix a potential memory leak
This commit is contained in:
parent
d9160fb4b9
commit
e7ffb74ad1
|
@ -176,8 +176,7 @@ proc_freepagetable(pagetable_t pagetable, uint64 sz)
|
||||||
{
|
{
|
||||||
uvmunmap(pagetable, TRAMPOLINE, PGSIZE, 0);
|
uvmunmap(pagetable, TRAMPOLINE, PGSIZE, 0);
|
||||||
uvmunmap(pagetable, TRAPFRAME, PGSIZE, 0);
|
uvmunmap(pagetable, TRAPFRAME, PGSIZE, 0);
|
||||||
if(sz > 0)
|
uvmfree(pagetable, sz);
|
||||||
uvmfree(pagetable, sz);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// a user program that calls exec("/init")
|
// a user program that calls exec("/init")
|
||||||
|
|
|
@ -301,7 +301,8 @@ freewalk(pagetable_t pagetable)
|
||||||
void
|
void
|
||||||
uvmfree(pagetable_t pagetable, uint64 sz)
|
uvmfree(pagetable_t pagetable, uint64 sz)
|
||||||
{
|
{
|
||||||
uvmunmap(pagetable, 0, sz, 1);
|
if(sz > 0)
|
||||||
|
uvmunmap(pagetable, 0, sz, 1);
|
||||||
freewalk(pagetable);
|
freewalk(pagetable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue