From: Amos Jeffries Date: Tue, 3 Feb 2009 23:06:06 +0000 (+1300) Subject: Author: Christos Tsantilas X-Git-Tag: SQUID_3_2_0_1~1217 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=be619e1e71b0e9d27fc410d0594178e2548f5367;p=thirdparty%2Fsquid.git Author: Christos Tsantilas Bug 2586: adaptation memory leaks on reconfigure --- diff --git a/src/adaptation/Config.cc b/src/adaptation/Config.cc index 993978a940..5129e1484c 100644 --- a/src/adaptation/Config.cc +++ b/src/adaptation/Config.cc @@ -161,6 +161,19 @@ 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) { @@ -182,14 +195,6 @@ Adaptation::Config::Config() // with global arrays shared by those individual configs Adaptation::Config::~Config() { - FreeAccess(); - FreeServiceSet(); - - // invalidate each service so that it can be deleted when refcount=0 - while (!AllServices().empty()) { - AllServices().back()->invalidate(); - AllServices().pop_back(); - } - + Adaptation::Config::DestroyConfig(); freeService(); } diff --git a/src/adaptation/Config.h b/src/adaptation/Config.h index bf6c330096..9cd33baba5 100644 --- a/src/adaptation/Config.h +++ b/src/adaptation/Config.h @@ -27,6 +27,7 @@ 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 6188c30fda..8c72d8dae1 100644 --- a/src/adaptation/ServiceConfig.cc +++ b/src/adaptation/ServiceConfig.cc @@ -67,6 +67,7 @@ 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 ea43f2fec8..2914269bbc 100644 --- a/src/main.cc +++ b/src/main.cc @@ -685,6 +685,10 @@ mainReconfigureStart(void) idnsShutdown(); #endif +#if USE_ADAPTATION + Adaptation::Config::DestroyConfig(); +#endif + redirectShutdown(); authenticateShutdown(); externalAclShutdown(); @@ -1666,6 +1670,11 @@ SquidShutdown() releaseServerSockets(); commCloseAllSockets(); + +#if USE_ADAPTATION + Adaptation::Config::DestroyConfig(); +#endif + #if DELAY_POOLS DelayPools::FreePools();