From 6d6a53f147d3d85db802efd20f8aac988a439805 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Thu, 16 Jan 2025 20:07:31 -0500 Subject: [PATCH] kernel/fs: Add missing frees to I/O context destruction. Fixes a memory leak regression from 12d6ecf0df54dc8752f7ccd1f430d74f45fcbd9b. --- src/system/kernel/fs/vfs.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/system/kernel/fs/vfs.cpp b/src/system/kernel/fs/vfs.cpp index c69d3967ae..d484636b6d 100644 --- a/src/system/kernel/fs/vfs.cpp +++ b/src/system/kernel/fs/vfs.cpp @@ -3657,6 +3657,9 @@ free_io_context(io_context* context) rw_lock_destroy(&context->lock); remove_node_monitors(context); + + free(context->fds_close_on_exec); + free(context->select_infos); free(context->fds); free(context); @@ -5036,7 +5039,7 @@ vfs_resize_fd_table(struct io_context* context, uint32 newSize) // If the tables shrink, make sure none of the fds being dropped are in use. if (newSize < oldSize) { for (uint32 i = oldSize; i-- > newSize;) { - if (context->fds[i]) + if (context->fds[i] != NULL) return B_BUSY; } }