mirror of
				https://github.com/bytecodealliance/wasm-micro-runtime.git
				synced 2025-10-31 13:17:31 +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)) { | ||||
|             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; | ||||
|     } | ||||
| 
 | ||||
|  | @ -1589,6 +1592,7 @@ wasm_module_malloc(WASMModuleInstance *module_inst, uint32 size, | |||
|     } | ||||
|     if (p_native_addr) | ||||
|         *p_native_addr = addr; | ||||
| 
 | ||||
|     return (uint32)(addr - memory->memory_data); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Xu Jun
						Xu Jun