about summary refs log tree commit diff stats
path: root/src/wrapped
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-04-10 18:51:07 +0200
committerptitSeb <sebastien.chev@gmail.com>2023-04-10 18:51:16 +0200
commit5d6307184941f6f2171153df6a5bb0105fcbce9e (patch)
treec0c31a50eac0c58725ba8418154ca48a3c4ae2a9 /src/wrapped
parent8c98c7b67580b2807d37fa03f59416f4526df770 (diff)
downloadbox64-5d6307184941f6f2171153df6a5bb0105fcbce9e.tar.gz
box64-5d6307184941f6f2171153df6a5bb0105fcbce9e.zip
[ELFLOADER] Improved handling of Failed-to-load library (and unloading of libs too)
Diffstat (limited to 'src/wrapped')
-rwxr-xr-xsrc/wrapped/wrappedlibdl.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/wrapped/wrappedlibdl.c b/src/wrapped/wrappedlibdl.c
index 952de79d..2089a12c 100755
--- a/src/wrapped/wrappedlibdl.c
+++ b/src/wrapped/wrappedlibdl.c
@@ -339,7 +339,9 @@ int my_dlclose(x64emu_t* emu, void *handle)
         return -1;
     }
     dl->count[nlib] = dl->count[nlib]-1;
-    FiniLibrary(dl->libs[nlib], emu);
+    if(!DecRefCount(&dl->libs[nlib], emu)) {
+        dl->count[nlib] = 0;
+    }
     return 0;
 }
 int my_dladdr1(x64emu_t* emu, void *addr, void *i, void** extra_info, int flags)