diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2021-06-05 03:59:04 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-06-05 03:59:04 +0000 |
commit | 6f8377fa1f75e86dd00966bff4c69d173a9fadc4 (patch) | |
tree | 790d939aa65ad043194b9604e8fe13b68d862955 | |
parent | 4cc31efe5bfcce1d8e2cd3c818a2c0c448748c75 (diff) | |
parent | 707cb88cc7762c4732974a44e476b12d4b23c9fc (diff) | |
download | bionic-6f8377fa1f75e86dd00966bff4c69d173a9fadc4.tar.gz |
Snap for 7428328 from b887dc0b5c5ac8ffa993a1ac6899ae92b6dbe8cb to sc-release am: 707cb88cc7
Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/14848509
Change-Id: I3e4203d15fc63a2d14a5bd2f062a002d464af894
-rw-r--r-- | libc/bionic/malloc_heapprofd.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/libc/bionic/malloc_heapprofd.cpp b/libc/bionic/malloc_heapprofd.cpp index 198bcbab7..741b45e98 100644 --- a/libc/bionic/malloc_heapprofd.cpp +++ b/libc/bionic/malloc_heapprofd.cpp @@ -325,12 +325,12 @@ void HeapprofdRememberHookConflict() { static void CommonInstallHooks(libc_globals* globals) { void* impl_handle = atomic_load(&gHeapprofdHandle); - bool reusing_handle = impl_handle != nullptr; - if (!reusing_handle) { + if (impl_handle == nullptr) { impl_handle = LoadSharedLibrary(kHeapprofdSharedLib, kHeapprofdPrefix, &globals->malloc_dispatch_table); if (impl_handle == nullptr) { return; } + atomic_store(&gHeapprofdHandle, impl_handle); } else if (!InitSharedLibrary(impl_handle, kHeapprofdSharedLib, kHeapprofdPrefix, &globals->malloc_dispatch_table)) { return; } @@ -341,11 +341,7 @@ static void CommonInstallHooks(libc_globals* globals) { // MaybeModifyGlobals locks at this point. atomic_store(&gPreviousDefaultDispatchTable, GetDefaultDispatchTable()); - if (FinishInstallHooks(globals, nullptr, kHeapprofdPrefix)) { - atomic_store(&gHeapprofdHandle, impl_handle); - } else if (!reusing_handle) { - dlclose(impl_handle); - } + FinishInstallHooks(globals, nullptr, kHeapprofdPrefix); } void HeapprofdInstallHooksAtInit(libc_globals* globals) { |