diff options
Diffstat (limited to 'linker/linker.cpp')
-rw-r--r-- | linker/linker.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp index f1ef55788..85376e0f7 100644 --- a/linker/linker.cpp +++ b/linker/linker.cpp @@ -321,7 +321,9 @@ static void soinfo_free(soinfo* si) { TRACE("name %s: freeing soinfo @ %p", si->get_realpath(), si); if (!solist_remove_soinfo(si)) { - async_safe_fatal("soinfo=%p is not in soinfo_list (double unload?)", si); + // TODO (dimitry): revisit this - for now preserving the logic + // but it does not look right, abort if soinfo is not in the list instead? + return; } // clear links to/from si @@ -1518,6 +1520,11 @@ bool find_libraries(android_namespace_t* ns, } }); + auto failure_guard = android::base::make_scope_guard([&]() { + // Housekeeping + soinfo_unload(soinfos, soinfos_count); + }); + ZipArchiveCache zip_archive_cache; // Step 1: expand the list of load_tasks to include @@ -1682,6 +1689,8 @@ bool find_libraries(android_namespace_t* ns, si->set_linked(); } }); + + failure_guard.Disable(); } return linked; @@ -1691,7 +1700,7 @@ static soinfo* find_library(android_namespace_t* ns, const char* name, int rtld_flags, const android_dlextinfo* extinfo, soinfo* needed_by) { - soinfo* si = nullptr; + soinfo* si; // readers_map is shared across recursive calls to find_libraries. // However, the map is not shared across different threads. @@ -1710,9 +1719,6 @@ static soinfo* find_library(android_namespace_t* ns, false /* add_as_children */, true /* search_linked_namespaces */, readers_map)) { - if (si != nullptr) { - soinfo_unload(si); - } return nullptr; } |