mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-06-01 14:37:14 +00:00
Fix allocate zero size memory warning (#1143)
Fix allocate zero size memory warning reported by wasm_runtime_malloc when allocating the import fun pointers if the import func count is 0: `warning: wasm_runtime_malloc with size zero`
This commit is contained in:
parent
749f2f1f34
commit
07829b90d7
|
@ -581,8 +581,9 @@ functions_instantiate(const WASMModule *module, WASMModuleInstance *module_inst,
|
||||||
}
|
}
|
||||||
|
|
||||||
total_size = sizeof(void *) * (uint64)module->import_function_count;
|
total_size = sizeof(void *) * (uint64)module->import_function_count;
|
||||||
if (!(module_inst->import_func_ptrs =
|
if (total_size > 0
|
||||||
runtime_malloc(total_size, error_buf, error_buf_size))) {
|
&& !(module_inst->import_func_ptrs =
|
||||||
|
runtime_malloc(total_size, error_buf, error_buf_size))) {
|
||||||
wasm_runtime_free(functions);
|
wasm_runtime_free(functions);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user