Fix similar leak in copyuvm

This commit is contained in:
Austin Clements 2010-09-01 00:27:12 -04:00
parent dd645ef119
commit ba04b3e70e

8
vm.c
View file

@ -313,13 +313,17 @@ copyuvm(pde_t *pgdir, uint sz)
if(*pte & PTE_P){
pa = PTE_ADDR(*pte);
if (!(mem = kalloc()))
return 0;
goto bad;
memmove(mem, (char *)pa, PGSIZE);
if (!mappages(d, (void *)i, PGSIZE, PADDR(mem), PTE_W|PTE_U))
return 0;
goto bad;
}
}
return d;
bad:
freevm(d);
return 0;
}
// Allocate one page table for the machine for the kernel address