Skip to content

Commit

Permalink
Fix a file leak in function at_kfd (riscv-software-src#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxXSoft authored May 1, 2022
1 parent c7e75bf commit 2efabd3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pk/syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ static int at_kfd(int dirfd)
file_t* dir = file_get(dirfd);
if (dir == NULL)
return -1;
return dir->kfd;
int kfd = dir->kfd;
file_decref(dir);
return kfd;
}

int sys_openat(int dirfd, const char* name, int flags, int mode)
Expand Down

0 comments on commit 2efabd3

Please sign in to comment.