Fix potential memory leak in insert_native_symbol (#3712)
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user