Skip to content

Commit 740f499

Browse files
authored
Fix potential memory leak in insert_native_symbol (#3712)
1 parent cce48a0 commit 740f499

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

core/iwasm/compilation/aot_llvm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3288,6 +3288,7 @@ insert_native_symbol(AOTCompContext *comp_ctx, const char *symbol, int32 idx)
32883288
bh_assert(strlen(symbol) <= sizeof(sym->symbol));
32893289
ret = snprintf(sym->symbol, sizeof(sym->symbol), "%s", symbol);
32903290
if (ret < 0 || ret + 1 > (int)sizeof(sym->symbol)) {
3291+
wasm_runtime_free(sym);
32913292
aot_set_last_error_v("symbol name too long: %s", symbol);
32923293
return false;
32933294
}

0 commit comments

Comments
 (0)