mirror of
https://github.com/ptitSeb/box64.git
synced 2025-05-09 00:21:32 +08:00
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.
This commit is contained in:
parent
0c27b82ff3
commit
4ca58d1f99
@ -6,6 +6,7 @@
|
||||
#include <pthread.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#include <wrappedlibs.h>
|
||||
#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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user