free proc if kalloc fails

This commit is contained in:
Robert Morris 2020-11-01 11:11:38 -05:00 committed by Frans Kaashoek
parent 5e392531c0
commit b48ea5d220

View file

@ -116,6 +116,7 @@ found:
// Allocate a trapframe page. // Allocate a trapframe page.
if((p->trapframe = (struct trapframe *)kalloc()) == 0){ if((p->trapframe = (struct trapframe *)kalloc()) == 0){
freeproc(p);
release(&p->lock); release(&p->lock);
return 0; return 0;
} }