From 387e54a5804653c4c4a22d958f05b4f91277a552 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Sun, 9 Jan 2022 18:58:03 -0800 Subject: fix file leak Eliminate excess reference count when associating fd with file. Fixes #258 --- pk/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- cgit v1.1