Просмотр исходного кода

[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 <yaozhongxiao@bytedance.com>
yaozhongxiao 3 лет назад
Родитель
Сommit
efc8bc10a9
1 измененных файлов с 1 добавлено и 0 удалено
  1. 1 0
      core/iwasm/interpreter/wasm_mini_loader.c

+ 1 - 0
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;