From efc8bc10a9d7dcc71d0bf8df6b8196fbb1e5b6ad Mon Sep 17 00:00:00 2001 From: yaozhongxiao Date: Wed, 27 Jul 2022 18:01:20 +0800 Subject: [PATCH] [bugfix] initialize "module->retain_function" for wasm_mini_loader (#1333) Before resolving the module function's export in wasm_mini_loader, "module->retain_function" need to be initialized, otherwise, the "__new" function export will lead to abort. issue: https://github.com/bytecodealliance/wasm-micro-runtime/issues/1332 Co-authored-by: yaozhongxiao --- core/iwasm/interpreter/wasm_mini_loader.c | 1 + 1 file changed, 1 insertion(+) diff --git a/core/iwasm/interpreter/wasm_mini_loader.c b/core/iwasm/interpreter/wasm_mini_loader.c index c7dc6ab8..fab1c285 100644 --- a/core/iwasm/interpreter/wasm_mini_loader.c +++ b/core/iwasm/interpreter/wasm_mini_loader.c @@ -1988,6 +1988,7 @@ load_from_sections(WASMModule *module, WASMSection *sections, module->malloc_function = (uint32)-1; module->free_function = (uint32)-1; + module->retain_function = (uint32)-1; /* Resolve malloc/free function exported by wasm module */ export = module->exports;