about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-04-10 11:10:43 +0200
committerptitSeb <sebastien.chev@gmail.com>2023-04-10 11:10:43 +0200
commite1108c5e17566cb666f870e545d87dc31959d7c2 (patch)
treec86a736afecaf84a61924e4c4601c1b89ddec8e5 /src
parent1d6eee32624561140a85eacefa5cfd496029a974 (diff)
downloadbox64-e1108c5e17566cb666f870e545d87dc31959d7c2.tar.gz
box64-e1108c5e17566cb666f870e545d87dc31959d7c2.zip
[DYNAREC] Destroy DynaBlock memory when freeing a lib
Diffstat (limited to 'src')
-rwxr-xr-xsrc/elfs/elfloader.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/elfs/elfloader.c b/src/elfs/elfloader.c
index 88dff2e9..c2705250 100755
--- a/src/elfs/elfloader.c
+++ b/src/elfs/elfloader.c
@@ -305,8 +305,12 @@ int AllocElfMemory(box64context_t* context, elfheader_t* head, int mainbin)
 void FreeElfMemory(elfheader_t* head)
 {
     if(head->multiblock_n) {
-        for(int i=0; i<head->multiblock_n; ++i)
+        for(int i=0; i<head->multiblock_n; ++i) {
+#ifdef DYNAREC
+            cleanDBFromAddressRange((uintptr_t)head->multiblock[i], head->multiblock_size[i], 1);
+#endif
             munmap(head->multiblock[i], head->multiblock_size[i]);
+        }
         box_free(head->multiblock);
         box_free(head->multiblock_size);
         box_free(head->multiblock_offs);