Skip to content
This repository has been archived by the owner on Feb 19, 2023. It is now read-only.

Commit

Permalink
fix bug when load failed
Browse files Browse the repository at this point in the history
  • Loading branch information
CCXXXI committed Jan 10, 2021
1 parent 72e39c0 commit 14a7248
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/userprog/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,11 @@ void process_exit(void)
self->thread = NULL;
self->status = PROCESS_EXITED;

ASSERT(self->file != NULL);
file_allow_write(self->file);
file_close(self->file);
if (self->file != NULL)
{
file_allow_write(self->file);
file_close(self->file);
}

sema_up(&self->sema_wait);
}
Expand Down

0 comments on commit 14a7248

Please sign in to comment.