Fix pointer unchecked issue in thread-mgr.c (#960)

And refine the code format of thread_manager.h
This commit is contained in:
Xu Jun
2022-01-14 17:57:59 +08:00
committed by GitHub
parent 9eb3ed6b15
commit ee97e30a1a
2 changed files with 65 additions and 64 deletions

View File

@ -344,13 +344,13 @@ wasm_cluster_spawn_exec_env(WASMExecEnv *exec_env)
{
WASMCluster *cluster = wasm_exec_env_get_cluster(exec_env);
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasm_module_t module = wasm_exec_env_get_module(exec_env);
wasm_module_t module;
wasm_module_inst_t new_module_inst;
WASMExecEnv *new_exec_env;
uint32 aux_stack_start, aux_stack_size;
uint32 stack_size = 8192;
if (!module) {
if (!module_inst || !(module = wasm_exec_env_get_module(exec_env))) {
return NULL;
}
@ -373,11 +373,9 @@ wasm_cluster_spawn_exec_env(WASMExecEnv *exec_env)
return NULL;
}
if (module_inst) {
/* Set custom_data to new module instance */
wasm_runtime_set_custom_data_internal(
new_module_inst, wasm_runtime_get_custom_data(module_inst));
}
/* Set custom_data to new module instance */
wasm_runtime_set_custom_data_internal(
new_module_inst, wasm_runtime_get_custom_data(module_inst));
new_exec_env = wasm_exec_env_create_internal(new_module_inst,
exec_env->wasm_stack_size);