diff options
author | MaxXing <x@MaxXSoft.net> | 2022-05-01 08:17:33 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-30 17:17:33 -0700 |
commit | 2efabd3e6604b8a9e8f70baf52f57696680c7855 (patch) | |
tree | 7fe7a12e90fdc821c6bc217590eb2ee06ab6a406 /pk | |
parent | c7e75bf944957e58f16531eb6b8d118a92069346 (diff) | |
download | riscv-pk-2efabd3e6604b8a9e8f70baf52f57696680c7855.zip riscv-pk-2efabd3e6604b8a9e8f70baf52f57696680c7855.tar.gz riscv-pk-2efabd3e6604b8a9e8f70baf52f57696680c7855.tar.bz2 |
Fix a file leak in function `at_kfd` (#276)
Diffstat (limited to 'pk')
-rw-r--r-- | pk/syscall.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pk/syscall.c b/pk/syscall.c index ec53b32..bda4393 100644 --- a/pk/syscall.c +++ b/pk/syscall.c @@ -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) |