From ff2768775c26337016f26aba6c395dcdfd5b30c7 Mon Sep 17 00:00:00 2001 From: TianlongLiang <111852609+TianlongLiang@users.noreply.github.com> Date: Tue, 22 Apr 2025 12:08:25 +0800 Subject: [PATCH] fix potential memory leak (#4205) --- .../libc-wasi/sandboxed-system-primitives/src/posix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c b/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c index d26c460fe..e48645d8c 100644 --- a/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c +++ b/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c @@ -3021,9 +3021,9 @@ fd_table_destroy(struct fd_table *ft) fd_object_release(NULL, ft->entries[i].object); } } - rwlock_destroy(&ft->lock); wasm_runtime_free(ft->entries); } + rwlock_destroy(&ft->lock); } void @@ -3035,9 +3035,9 @@ fd_prestats_destroy(struct fd_prestats *pt) wasm_runtime_free((void *)pt->prestats[i].dir); } } - rwlock_destroy(&pt->lock); wasm_runtime_free(pt->prestats); } + rwlock_destroy(&pt->lock); } bool