Skip to content

Commit

Permalink
Fix lookup function issue reported in nightly run (#3868)
Browse files Browse the repository at this point in the history
  • Loading branch information
wenyongh authored Oct 21, 2024
1 parent bb3f8d9 commit 87588ca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/iwasm/aot/aot_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -2222,6 +2222,9 @@ aot_lookup_function(const AOTModuleInstance *module_inst, const char *name)
(AOTFunctionInstance *)module_inst->export_functions;
AOTFunctionInstance key = { .func_name = (char *)name };

if (!export_funcs)
return NULL;

return bsearch(&key, export_funcs, module_inst->export_func_count,
sizeof(AOTFunctionInstance), cmp_func_inst);
}
Expand Down
3 changes: 3 additions & 0 deletions core/iwasm/interpreter/wasm_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -3437,6 +3437,9 @@ wasm_lookup_function(const WASMModuleInstance *module_inst, const char *name)
WASMExportFuncInstance key = { .name = (char *)name };
WASMExportFuncInstance *export_func_inst;

if (!module_inst->export_functions)
return NULL;

export_func_inst = bsearch(
&key, module_inst->export_functions, module_inst->export_func_count,
sizeof(WASMExportFuncInstance), cmp_export_func_inst);
Expand Down

0 comments on commit 87588ca

Please sign in to comment.