Skip to content

Commit 171c2cc

Browse files
committed
thanks mataness
1 parent 26108a3 commit 171c2cc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

vm.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,10 @@ copyuvm(pde_t *pgdir, uint sz)
332332
if((mem = kalloc()) == 0)
333333
goto bad;
334334
memmove(mem, (char*)P2V(pa), PGSIZE);
335-
if(mappages(d, (void*)i, PGSIZE, V2P(mem), flags) < 0)
335+
if(mappages(d, (void*)i, PGSIZE, V2P(mem), flags) < 0) {
336+
kfree(mem);
336337
goto bad;
338+
}
337339
}
338340
return d;
339341

0 commit comments

Comments
 (0)