mirror of
				https://github.com/bytecodealliance/wasm-micro-runtime.git
				synced 2025-10-31 13:17:31 +00:00 
			
		
		
		
	Fix module_realloc with NULL ptr issue (#1175)
Fix module_realloc with NULL ptr issue reported by #1173.
This commit is contained in:
		
							parent
							
								
									d7a2888b18
								
							
						
					
					
						commit
						c72501781a
					
				|  | @ -1837,7 +1837,7 @@ aot_module_realloc(AOTModuleInstance *module_inst, uint32 ptr, uint32 size, | |||
|     if (memory_inst->heap_handle.ptr) { | ||||
|         addr = mem_allocator_realloc( | ||||
|             memory_inst->heap_handle.ptr, | ||||
|             (uint8 *)memory_inst->memory_data.ptr + ptr, size); | ||||
|             ptr ? (uint8 *)memory_inst->memory_data.ptr + ptr : NULL, size); | ||||
|     } | ||||
| 
 | ||||
|     /* Only support realloc in WAMR's app heap */ | ||||
|  |  | |||
|  | @ -1917,8 +1917,8 @@ wasm_module_realloc(WASMModuleInstance *module_inst, uint32 ptr, uint32 size, | |||
|     } | ||||
| 
 | ||||
|     if (memory->heap_handle) { | ||||
|         addr = mem_allocator_realloc(memory->heap_handle, | ||||
|                                      memory->memory_data + ptr, size); | ||||
|         addr = mem_allocator_realloc( | ||||
|             memory->heap_handle, ptr ? memory->memory_data + ptr : NULL, size); | ||||
|     } | ||||
| 
 | ||||
|     /* Only support realloc in WAMR's app heap */ | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Wenyong Huang
						Wenyong Huang