Skip to content

Commit

Permalink
fix adjust heap issues
Browse files Browse the repository at this point in the history
  • Loading branch information
lum1n0us committed Oct 30, 2024
1 parent 0c58cc1 commit fbba2a3
Show file tree
Hide file tree
Showing 9 changed files with 204 additions and 221 deletions.
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ core/iwasm/libraries/lib-wasi-threads/test/*.wasm
core/iwasm/libraries/lib-socket/test/*.wasm

product-mini/app-samples/hello-world/test.wasm
product-mini/platforms/linux-sgx/enclave-sample/App/
product-mini/platforms/linux-sgx/enclave-sample/Enclave/
product-mini/platforms/linux-sgx/enclave-sample/iwasm
product-mini/platforms/linux-sgx/enclave-sample/App/*.o
product-mini/platforms/linux-sgx/enclave-sample/Enclave/*.o
product-mini/platforms/linux-sgx/enclave-sample/
!product-mini/platforms/linux-sgx/enclave-sample/Makefile*

build_out
tests/wamr-test-suites/workspace
Expand Down
8 changes: 4 additions & 4 deletions core/iwasm/common/wasm_runtime_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -7788,9 +7788,6 @@ wasm_runtime_destroy_extern_inst(WASMModuleCommon *module,
if (!extern_inst)
return;

extern_inst->module_name = NULL;
extern_inst->field_name = NULL;

if (extern_inst->kind == WASM_IMPORT_EXPORT_KIND_MEMORY) {
wasm_runtime_destroy_memory(module, extern_inst->u.memory);
extern_inst->u.memory = NULL;
Expand All @@ -7800,6 +7797,9 @@ wasm_runtime_destroy_extern_inst(WASMModuleCommon *module,
extern_inst->module_name, extern_inst->field_name,
extern_inst->kind);
}

extern_inst->module_name = NULL;
extern_inst->field_name = NULL;
}

/*
Expand Down Expand Up @@ -7841,7 +7841,7 @@ void
wasm_runtime_destroy_imports(WASMModuleCommon *module,
WASMExternInstance *extern_inst_list)
{
if (!module && !extern_inst_list)
if (!module || !extern_inst_list)
return;

for (int32 i = 0, import_count = wasm_runtime_get_import_count(module);
Expand Down
3 changes: 2 additions & 1 deletion core/iwasm/include/wasm_export.h
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,8 @@ wasm_runtime_set_module_inst(wasm_exec_env_t exec_env,
const wasm_module_inst_t module_inst);

/**
* Create a memory instance
* Create a memory instance.
* don't have a app heap
*
* @return The created memory instance if successful, NULL otherwise
*/
Expand Down
2 changes: 1 addition & 1 deletion core/iwasm/interpreter/wasm_interp_classic.c
Original file line number Diff line number Diff line change
Expand Up @@ -6727,7 +6727,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|| WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS == 0 \
|| WASM_ENABLE_BULK_MEMORY != 0
if (memory)
linear_mem_size = GET_LINEAR_MEMORY_SIZE(memory);
linear_mem_size = get_linear_mem_size();
#endif
if (wasm_copy_exception(module, NULL)) {
#if WASM_ENABLE_EXCE_HANDLING != 0
Expand Down
2 changes: 1 addition & 1 deletion core/iwasm/interpreter/wasm_interp_fast.c
Original file line number Diff line number Diff line change
Expand Up @@ -5994,7 +5994,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|| WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS == 0 \
|| WASM_ENABLE_BULK_MEMORY != 0
if (memory)
linear_mem_size = GET_LINEAR_MEMORY_SIZE(memory);
linear_mem_size = get_linear_mem_size();
#endif
if (wasm_copy_exception(module, NULL))
goto got_exception;
Expand Down
Loading

0 comments on commit fbba2a3

Please sign in to comment.