about summary refs log tree commit diff stats
path: root/src/librarian
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-03-04 13:40:49 +0100
committerptitSeb <sebastien.chev@gmail.com>2024-03-04 13:40:57 +0100
commit9e37dd008d5710f03385c8afd1ef2aed728a8fe0 (patch)
treea3838216baa79629472cffda264ba971fb3674a2 /src/librarian
parent5b1057fe08f08c0c9c5dba5c9b7069a48b55c4ee (diff)
downloadbox64-9e37dd008d5710f03385c8afd1ef2aed728a8fe0.tar.gz
box64-9e37dd008d5710f03385c8afd1ef2aed728a8fe0.zip
[ELFLOADER] Fixes some issue with symbol version matching and unload of failled libs (for #1311, probably other too)
Diffstat (limited to 'src/librarian')
-rw-r--r--src/librarian/librarian.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/librarian/librarian.c b/src/librarian/librarian.c
index 9b5e82ac..4aff1864 100644
--- a/src/librarian/librarian.c
+++ b/src/librarian/librarian.c
@@ -333,9 +333,16 @@ int AddNeededLib(lib_t* maplib, int local, int bindnow, int deepbind, needed_lib
     for (int i=0; i<n; ++i)
         if(AddNeededLib_init(maplib, local, bindnow, deepbind, needed->libs[n-i-1], verneeded, box64, emu)) {
             printf_log(LOG_INFO, "Error initializing needed lib %s\n", needed->names[i]);
-            if(!allow_missing_libs) ret = 1;
+            ret = 1;
         }
     // error while loadind lib, unload...
+    if(ret) {
+        int n = needed->size;
+        for (int i=0; i<n; ++i)
+            DecRefCount(&needed->libs[n-i-1], emu);
+    }
+    // all done
+    if(allow_missing_libs) return 0;
     return ret;
 }
 EXPORTDYN