From: Christos Tsantilas Date: Fri, 14 Jan 2011 17:45:23 +0000 (+0200) Subject: Bug 2586: multiple memory leaks during reconfigure X-Git-Tag: take00~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=29bf4910b27e6729bd8963cfceddf9df8b7f49c6;p=thirdparty%2Fsquid.git Bug 2586: multiple memory leaks during reconfigure 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 --- diff --git a/src/adaptation/ServiceConfig.cc b/src/adaptation/ServiceConfig.cc index 9751422f05..176ce2110a 100644 --- a/src/adaptation/ServiceConfig.cc +++ b/src/adaptation/ServiceConfig.cc @@ -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; diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 0c72ed1a4b..4601feb536 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -3957,6 +3957,9 @@ void configFreeMemory(void) { free_all(); +#if USE_SSL + SSL_CTX_free(Config.ssl_client.sslContext); +#endif } void diff --git a/src/mime.cc b/src/mime.cc index c4113f7e73..cf90d4c5a8 100644 --- a/src/mime.cc +++ b/src/mime.cc @@ -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) {