]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Do not register the same Cache Manager action more than once
authorAlex Rousskov <rousskov@measurement-factory.com>
Mon, 2 Jun 2014 05:16:35 +0000 (22:16 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 2 Jun 2014 05:16:35 +0000 (22:16 -0700)
... to avoid wrong mgr:menu output and the impression of a reconfigure
memory leak.

The old code was comparing action object pointers, which could not work,
and was adding the same action on every reconfigure call for modules that
register with Cache Manager during [re]configuration.

We already have a working method for finding registered actions. Use it.

src/cache_manager.cc

index 66976cd916991b95294ecddafd10fa1d4e5db021..4598b9d96440e1a05c74d2eba5f46f4f10f9a2b0 100644 (file)
@@ -82,7 +82,7 @@ void
 CacheManager::registerProfile(const Mgr::ActionProfile::Pointer &profile)
 {
     Must(profile != NULL);
-    if (std::find(menu_.begin(), menu_.end(), profile) == menu_.end()) {
+    if (!CacheManager::findAction(profile->name)) {
         menu_.push_back(profile);
         debugs(16, 3, HERE << "registered profile: " << *profile);
     } else {