]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Regression Fix: Bug #2586: adaptation memory leaks on reconfigure
authorChristos Tsantilas <chtsanti@users.sourceforge.net>
Mon, 16 Feb 2009 21:24:39 +0000 (23:24 +0200)
committerChristos Tsantilas <chtsanti@users.sourceforge.net>
Mon, 16 Feb 2009 21:24:39 +0000 (23:24 +0200)
The patch is wrong: on shutdown calls Adaptation::Config::DestroyConfig,
twice causing segmentation fault.

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

index bb3f7cc86ce10134f4836852d69016047292c302..d42a2818c37e9e1c9e0161913942d1e307589913 100644 (file)
@@ -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();
 }
index 9cd33baba5a55ab02d670ac92dda72b5ac367d3e..bf6c3300964cd03c9043f20c236186d685f2a442 100644 (file)
@@ -27,7 +27,6 @@ class Config
 {
 public:
     static void Finalize(bool enable);
-    static void DestroyConfig();
 
     static void ParseServiceSet(void);
     static void FreeServiceSet(void);
index fae5db4eb91772cdb4321d9a08aa3dc4ceebfd38..40b494cb7a590edb8faec2b6c93871235949ddbd 100644 (file)
@@ -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());
index 2914269bbc069f9e70835859506c378955d6b00a..ea43f2fec868e02773f7d8dfbe5c595909513c90 100644 (file)
@@ -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();