From d7c98d4691a5bf7ecb1556c61b97685ff5b0dfd1 Mon Sep 17 00:00:00 2001 From: Wenyong Huang Date: Wed, 14 Aug 2024 16:13:50 +0800 Subject: [PATCH] Fix potential memory leak in insert_native_symbol --- core/iwasm/compilation/aot_llvm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/core/iwasm/compilation/aot_llvm.c b/core/iwasm/compilation/aot_llvm.c index fcf2919192..d52a486a07 100644 --- a/core/iwasm/compilation/aot_llvm.c +++ b/core/iwasm/compilation/aot_llvm.c @@ -3288,6 +3288,7 @@ insert_native_symbol(AOTCompContext *comp_ctx, const char *symbol, int32 idx) bh_assert(strlen(symbol) <= sizeof(sym->symbol)); ret = snprintf(sym->symbol, sizeof(sym->symbol), "%s", symbol); if (ret < 0 || ret + 1 > (int)sizeof(sym->symbol)) { + wasm_runtime_free(sym); aot_set_last_error_v("symbol name too long: %s", symbol); return false; }