提交 ffe44492 创建 作者: Cody Cutler's avatar Cody Cutler

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.
上级 91fd3470
......@@ -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)
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论