fix possible memory leak in deallocuvm
when a zero PDE is encountered while searching for present PTEs to free, resume searching at first entry of the next page table instead of the current entry of the next page table.
This commit is contained in:
parent
91fd3470b0
commit
ffe444926e
2
vm.c
2
vm.c
|
@ -266,7 +266,7 @@ deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
|
||||||
for(; a < oldsz; a += PGSIZE){
|
for(; a < oldsz; a += PGSIZE){
|
||||||
pte = walkpgdir(pgdir, (char*)a, 0);
|
pte = walkpgdir(pgdir, (char*)a, 0);
|
||||||
if(!pte)
|
if(!pte)
|
||||||
a += (NPTENTRIES - 1) * PGSIZE;
|
a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE;
|
||||||
else if((*pte & PTE_P) != 0){
|
else if((*pte & PTE_P) != 0){
|
||||||
pa = PTE_ADDR(*pte);
|
pa = PTE_ADDR(*pte);
|
||||||
if(pa == 0)
|
if(pa == 0)
|
||||||
|
|
Loading…
Reference in a new issue