]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 2586: multiple memory leaks during reconfigure
authorChristos Tsantilas <chtsanti@users.sourceforge.net>
Fri, 14 Jan 2011 17:45:23 +0000 (19:45 +0200)
committerChristos Tsantilas <chtsanti@users.sourceforge.net>
Fri, 14 Jan 2011 17:45:23 +0000 (19:45 +0200)
This patch fixes:
   - a SSL_CTX object memory leak
   - a very small memory leak in MimeIcon class
   - a small memory leak while parsing adaptation_service

src/adaptation/ServiceConfig.cc
src/cache_cf.cc
src/mime.cc

index 9751422f056f38fa5d2bf9028dc0c9e2eff9df15..176ce2110ae20cfd5ae2c71b5f75418ebca04f31 100644 (file)
@@ -57,12 +57,12 @@ Adaptation::ServiceConfig::parseVectPoint(const char *service_configConfig) cons
 bool
 Adaptation::ServiceConfig::parse()
 {
-    char *method_point = NULL;
+    String method_point;
 
     ConfigParser::ParseString(&key);
     ConfigParser::ParseString(&method_point);
-    method = parseMethod(method_point);
-    point = parseVectPoint(method_point);
+    method = parseMethod(method_point.termedBuf());
+    point = parseVectPoint(method_point.termedBuf());
 
     // reset optional parameters in case we are reconfiguring
     bypass = routing = false;
index 0c72ed1a4b0999e69efdf864adfd1b2f0bd1f0c8..4601feb5366a3d724d8a46d5ae0edf4c782dc426 100644 (file)
@@ -3957,6 +3957,9 @@ void
 configFreeMemory(void)
 {
     free_all();
+#if USE_SSL
+    SSL_CTX_free(Config.ssl_client.sslContext);
+#endif
 }
 
 void
index c4113f7e73e824044707c18adf54e39d089ba4c8..cf90d4c5a84a69be6d1cbf93322f316f11478709 100644 (file)
@@ -49,6 +49,7 @@ class MimeIcon : public StoreClient
 
 public:
     MimeIcon ();
+    ~MimeIcon ();
     void setName (char const *);
     char const * getName () const;
     void _free();
@@ -137,6 +138,11 @@ mimeGetEntry(const char *fn, int skip_encodings)
 MimeIcon::MimeIcon () : icon (NULL), url (NULL)
 {}
 
+MimeIcon::~MimeIcon ()
+{
+    _free();
+}
+
 void
 MimeIcon::setName (char const *aString)
 {