Skip to content

Commit

Permalink
fix possible memory leak in deallocuvm
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Cody Cutler committed Sep 26, 2016
1 parent 91fd347 commit ffe4449
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
for(; a < oldsz; a += PGSIZE){
pte = walkpgdir(pgdir, (char*)a, 0);
if(!pte)
a += (NPTENTRIES - 1) * PGSIZE;
a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE;
else if((*pte & PTE_P) != 0){
pa = PTE_ADDR(*pte);
if(pa == 0)
Expand Down

0 comments on commit ffe4449

Please sign in to comment.