Fix some issues reported by Coverity (#1150)

module_wasm_app.c: add return value check for wasm_runtime_call_wasm
aot_runtime.c: add return value check for aot_get_default_memory
aot_runtime.c: add return value check before calling wasm app malloc/free func
wasm_runtime_common.c: fix dead code warning in wasm_runtime_load_from_sections
aot_emit_memory.c: fix potential integer overflow issue
wasm_runtime.c: remove dead code in memory_instantiate, add assertion for globals
samples simple/gui/littlevgl: fix fields of struct sigaction initialization issue
host-tool: add return value check for sendto
This commit is contained in:
Wenyong Huang
2022-05-07 16:51:43 +08:00
committed by GitHub
parent d62543c99c
commit 2bac6a42a7
10 changed files with 41 additions and 33 deletions

View File

@ -492,9 +492,16 @@ wasm_app_routine(void *arg)
fail2:
/* Call WASM app onDestroy() method if there is */
func_onDestroy = app_manager_lookup_function(inst, "_on_destroy", "()");
if (func_onDestroy)
wasm_runtime_call_wasm(wasm_app_data->exec_env, func_onDestroy, 0,
NULL);
if (func_onDestroy) {
if (!wasm_runtime_call_wasm(wasm_app_data->exec_env, func_onDestroy, 0,
NULL)) {
const char *exception = wasm_runtime_get_exception(inst);
bh_assert(exception);
app_manager_printf("Got exception running WASM code: %s\n",
exception);
wasm_runtime_clear_exception(inst);
}
}
fail1: