]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Christos Tsantilas <chtsanti@users.sourceforge.net>
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 3 Feb 2009 23:06:06 +0000 (12:06 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 3 Feb 2009 23:06:06 +0000 (12:06 +1300)
Bug 2586: adaptation memory leaks on reconfigure

src/adaptation/Config.cc
src/adaptation/Config.h
src/adaptation/ServiceConfig.cc
src/main.cc

index 993978a940f38b3f25d51af7b70a7a07c3c7ca6b..5129e1484cd5cab16a8fdba381179188785640bf 100644 (file)
@@ -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();
 }
index bf6c3300964cd03c9043f20c236186d685f2a442..9cd33baba5a55ab02d670ac92dda72b5ac367d3e 100644 (file)
@@ -27,6 +27,7 @@ class Config
 {
 public:
     static void Finalize(bool enable);
+    static void DestroyConfig();
 
     static void ParseServiceSet(void);
     static void FreeServiceSet(void);
index 6188c30fdae308fd01c7255355ba7af1d45a61e8..8c72d8dae1b9baddb6023ab13f696627b31474ca 100644 (file)
@@ -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());
index ea43f2fec868e02773f7d8dfbe5c595909513c90..2914269bbc069f9e70835859506c378955d6b00a 100644 (file)
@@ -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();