diff options
author | Andrew Waterman <andrew@sifive.com> | 2022-01-09 18:58:03 -0800 |
---|---|---|
committer | Andrew Waterman <andrew@sifive.com> | 2022-01-09 18:58:03 -0800 |
commit | 387e54a5804653c4c4a22d958f05b4f91277a552 (patch) | |
tree | 51c143daa2b7613a13ffcb2541b378570a92e61c /pk | |
parent | 4ae5a8876fc2c31776b1777405ab14f764cc0f36 (diff) | |
download | pk-387e54a5804653c4c4a22d958f05b4f91277a552.zip pk-387e54a5804653c4c4a22d958f05b4f91277a552.tar.gz pk-387e54a5804653c4c4a22d958f05b4f91277a552.tar.bz2 |
fix file leak
Eliminate excess reference count when associating fd with file.
Fixes #258
Diffstat (limited to 'pk')
-rw-r--r-- | pk/syscall.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pk/syscall.c b/pk/syscall.c index 03eee27..f8d2157 100644 --- a/pk/syscall.c +++ b/pk/syscall.c @@ -145,8 +145,8 @@ int sys_openat(int dirfd, const char* name, int flags, int mode) return PTR_ERR(file); int fd = file_dup(file); + file_decref(file); // counteract file_dup's file_incref if (fd < 0) { - file_decref(file); return -ENOMEM; } |