From: Francis Dupont Date: Sun, 28 Jun 2020 15:17:43 +0000 (+0200) Subject: [#1282] Fixed a corner case race X-Git-Tag: Kea-1.7.10~128 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12640be3e48fc952265a12fbdadd71ce06c02331;p=thirdparty%2Fkea.git [#1282] Fixed a corner case race --- diff --git a/src/lib/hooks/hooks_manager.cc b/src/lib/hooks/hooks_manager.cc index 868f48192c..c19bfcac60 100644 --- a/src/lib/hooks/hooks_manager.cc +++ b/src/lib/hooks/hooks_manager.cc @@ -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 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.