From 44b6b26eb8a6463c9f0658aa5fb246b3b8a53905 Mon Sep 17 00:00:00 2001 From: Matheus Date: Tue, 20 Sep 2022 16:59:40 -0300 Subject: [PATCH] syscalls: properly free the fd on an open failure --- src/sys/syscalls/open.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sys/syscalls/open.c b/src/sys/syscalls/open.c index fed4ac62..3a8ddd3c 100644 --- a/src/sys/syscalls/open.c +++ b/src/sys/syscalls/open.c @@ -80,7 +80,9 @@ syscallret syscall_open(const char* pathname, int flags, mode_t mode){ if(file) vfs_close(file); + fd_release(fd); + fd_free(&proc->fdtable, fd); fd->node = NULL; free(name); return retv;