mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-09 13:16:26 +00:00
fix problem in wasm_module_malloc (#374)
This commit is contained in:
parent
2e0cef3ef1
commit
2135badc54
|
@ -1580,6 +1580,9 @@ wasm_module_malloc(WASMModuleInstance *module_inst, uint32 size,
|
||||||
size, &offset)) {
|
size, &offset)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
/* If we use app's malloc function,
|
||||||
|
the default memory may be changed while memory growing */
|
||||||
|
memory = module_inst->default_memory;
|
||||||
addr = offset ? memory->memory_data + offset : NULL;
|
addr = offset ? memory->memory_data + offset : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1589,6 +1592,7 @@ wasm_module_malloc(WASMModuleInstance *module_inst, uint32 size,
|
||||||
}
|
}
|
||||||
if (p_native_addr)
|
if (p_native_addr)
|
||||||
*p_native_addr = addr;
|
*p_native_addr = addr;
|
||||||
|
|
||||||
return (uint32)(addr - memory->memory_data);
|
return (uint32)(addr - memory->memory_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user