From 4ca58d1f994900d2025258cadf19dd633c8a7c09 Mon Sep 17 00:00:00 2001 From: mogery Date: Tue, 12 Oct 2021 20:05:22 +0200 Subject: Fix incorrect brick cleanup FreeBridge used free to clean up the pointer allocated by my_mmap, which is incorrect and lead to a crash upon code that exited gracefully. The free was replaced with my_munmap. --- src/tools/bridge.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/tools/bridge.c b/src/tools/bridge.c index c800b8c5..4ee34824 100755 --- a/src/tools/bridge.c +++ b/src/tools/bridge.c @@ -6,6 +6,7 @@ #include #include +#include #include "custommem.h" #include "bridge.h" #include "bridge_private.h" @@ -59,13 +60,14 @@ void FreeBridge(bridge_t** bridge) if(!bridge || !*bridge) return; brick_t *b = (*bridge)->head; + x64emu_t* emu = thread_get_emu(); while(b) { brick_t *n = b->next; #ifdef DYNAREC if(getProtection((uintptr_t)b->b)&PROT_DYNAREC) unprotectDB((uintptr_t)b->b, NBRICK*sizeof(onebridge_t)); #endif - free(b->b); + my_munmap(emu, b->b, NBRICK*sizeof(onebridge_t)); free(b); b = n; } -- cgit 1.4.1