]> 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>
Tue, 3 Jun 2014 07:10:53 +0000 (01:10 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 3 Jun 2014 07:10:53 +0000 (01:10 -0600)
... 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 9d881b5cf463989aa7a5029f3b95e7ec59334735..b66d8d65039c1fc4d32eb87c7e53793ad7dfbcc4 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 {