]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1282] Fixed a corner case race
authorFrancis Dupont <fdupont@isc.org>
Sun, 28 Jun 2020 15:17:43 +0000 (17:17 +0200)
committerFrancis Dupont <fdupont@isc.org>
Sun, 28 Jun 2020 15:17:43 +0000 (17:17 +0200)
src/lib/hooks/hooks_manager.cc

index 868f48192cece852b406b3281fc927e8064d270f..c19bfcac605cf0e5d928ddf815594fdca35477ba 100644 (file)
@@ -152,8 +152,14 @@ HooksManager::unloadLibrariesInternal() {
     // was not destroyed and libraries not closed.
     if (!weak_lmc.expired()) {
         // Restore the library manager collection.
-        lm_collection_ = weak_lmc.lock();
-        return (false);
+        boost::shared_ptr<LibraryManagerCollection> restored_lmc = weak_lmc.lock();
+        if (restored_lmc) {
+            lm_collection_ = restored_lmc;
+            return (false);
+        }
+        // The library manager collection was destroyed between calls to
+        // expired and lock.
+        // assert(weak_lmc.expired());
     }
 
     // Load the empty set of libraries.