mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-02-06 23:15:16 +00:00
Fix a bug of the return value of memory_instantiate (#1616)
Since `memory` is not NULL, memory_instantiate will return non-null value when failed.
This commit is contained in:
parent
86d3f30600
commit
1c5034bdfa
|
@ -296,6 +296,7 @@ memory_instantiate(WASMModuleInstance *module_inst, WASMMemoryInstance *memory,
|
|||
#endif
|
||||
bh_assert(memory_data_size <= 4 * (uint64)BH_GB);
|
||||
|
||||
bh_assert(memory != NULL);
|
||||
#ifndef OS_ENABLE_HW_BOUND_CHECK
|
||||
if (memory_data_size > 0
|
||||
&& !(memory->memory_data =
|
||||
|
@ -416,7 +417,7 @@ fail2:
|
|||
os_munmap(mapped_mem, map_size);
|
||||
#endif
|
||||
fail1:
|
||||
return memory;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user