diff options
Diffstat (limited to 'linker/linker.cpp')
-rw-r--r-- | linker/linker.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp index 1a005faa0..ac7ad1ca2 100644 --- a/linker/linker.cpp +++ b/linker/linker.cpp @@ -321,9 +321,7 @@ static void soinfo_free(soinfo* si) { TRACE("name %s: freeing soinfo @ %p", si->get_realpath(), si); if (!solist_remove_soinfo(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; + async_safe_fatal("soinfo=%p is not in soinfo_list (double unload?)", si); } // clear links to/from si @@ -1541,11 +1539,6 @@ 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 @@ -1710,8 +1703,6 @@ bool find_libraries(android_namespace_t* ns, si->set_linked(); } }); - - failure_guard.Disable(); } return linked; @@ -1721,7 +1712,7 @@ static soinfo* find_library(android_namespace_t* ns, const char* name, int rtld_flags, const android_dlextinfo* extinfo, soinfo* needed_by) { - soinfo* si; + soinfo* si = nullptr; // readers_map is shared across recursive calls to find_libraries. // However, the map is not shared across different threads. @@ -1740,6 +1731,9 @@ 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; } |