mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-06-01 14:37:14 +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
|
#endif
|
||||||
bh_assert(memory_data_size <= 4 * (uint64)BH_GB);
|
bh_assert(memory_data_size <= 4 * (uint64)BH_GB);
|
||||||
|
|
||||||
|
bh_assert(memory != NULL);
|
||||||
#ifndef OS_ENABLE_HW_BOUND_CHECK
|
#ifndef OS_ENABLE_HW_BOUND_CHECK
|
||||||
if (memory_data_size > 0
|
if (memory_data_size > 0
|
||||||
&& !(memory->memory_data =
|
&& !(memory->memory_data =
|
||||||
|
@ -416,7 +417,7 @@ fail2:
|
||||||
os_munmap(mapped_mem, map_size);
|
os_munmap(mapped_mem, map_size);
|
||||||
#endif
|
#endif
|
||||||
fail1:
|
fail1:
|
||||||
return memory;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user