From: Christos Tsantilas Date: Mon, 16 Feb 2009 21:24:39 +0000 (+0200) Subject: Regression Fix: Bug #2586: adaptation memory leaks on reconfigure X-Git-Tag: SQUID_3_2_0_1~1194 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e029ec30f3b77da6f59571dc114929792a8302f;p=thirdparty%2Fsquid.git Regression Fix: Bug #2586: adaptation memory leaks on reconfigure The patch is wrong: on shutdown calls Adaptation::Config::DestroyConfig, twice causing segmentation fault. --- diff --git a/src/adaptation/Config.cc b/src/adaptation/Config.cc index bb3f7cc86c..d42a2818c3 100644 --- a/src/adaptation/Config.cc +++ b/src/adaptation/Config.cc @@ -166,19 +166,6 @@ Adaptation::Config::FreeAccess() } } -void -Adaptation::Config::DestroyConfig() -{ - FreeAccess(); - FreeServiceSet(); - - // invalidate each service so that it can be deleted when refcount=0 - while (!AllServices().empty()) { - AllServices().back()->invalidate(); - AllServices().pop_back(); - } -} - void Adaptation::Config::DumpAccess(StoreEntry *entry, const char *name) { @@ -200,6 +187,14 @@ Adaptation::Config::Config() // with global arrays shared by those individual configs Adaptation::Config::~Config() { - Adaptation::Config::DestroyConfig(); + FreeAccess(); + FreeServiceSet(); + + // invalidate each service so that it can be deleted when refcount=0 + while (!AllServices().empty()) { + AllServices().back()->invalidate(); + AllServices().pop_back(); + } + freeService(); } diff --git a/src/adaptation/Config.h b/src/adaptation/Config.h index 9cd33baba5..bf6c330096 100644 --- a/src/adaptation/Config.h +++ b/src/adaptation/Config.h @@ -27,7 +27,6 @@ class Config { public: static void Finalize(bool enable); - static void DestroyConfig(); static void ParseServiceSet(void); static void FreeServiceSet(void); diff --git a/src/adaptation/ServiceConfig.cc b/src/adaptation/ServiceConfig.cc index fae5db4eb9..40b494cb7a 100644 --- a/src/adaptation/ServiceConfig.cc +++ b/src/adaptation/ServiceConfig.cc @@ -67,7 +67,6 @@ Adaptation::ServiceConfig::parse() method = parseMethod(method_point); point = parseVectPoint(method_point); - safe_free(method_point); debugs(3, 5, HERE << cfg_filename << ':' << config_lineno << ": " << "service_configConfig is " << methodStr() << "_" << vectPointStr()); diff --git a/src/main.cc b/src/main.cc index 2914269bbc..ea43f2fec8 100644 --- a/src/main.cc +++ b/src/main.cc @@ -685,10 +685,6 @@ mainReconfigureStart(void) idnsShutdown(); #endif -#if USE_ADAPTATION - Adaptation::Config::DestroyConfig(); -#endif - redirectShutdown(); authenticateShutdown(); externalAclShutdown(); @@ -1670,11 +1666,6 @@ SquidShutdown() releaseServerSockets(); commCloseAllSockets(); - -#if USE_ADAPTATION - Adaptation::Config::DestroyConfig(); -#endif - #if DELAY_POOLS DelayPools::FreePools();