From: Amos Jeffries Date: Sun, 8 Feb 2009 00:23:36 +0000 (+1300) Subject: Memory leak on PconnPools X-Git-Tag: SQUID_3_2_0_1~1208 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7a56c5093a6f3a5082f99052523141e752cbf9bd;p=thirdparty%2Fsquid.git Memory leak on PconnPools Need to free the Pconn hash table properly. constructor/desctructor are both required. --- diff --git a/src/pconn.cc b/src/pconn.cc index 223e8022ef..59dd417b1c 100644 --- a/src/pconn.cc +++ b/src/pconn.cc @@ -238,14 +238,18 @@ PconnPool::PconnPool(const char *aDescr) : table(NULL), descr(aDescr) for (i = 0; i < PCONN_HIST_SZ; i++) hist[i] = 0; - PconnModule::GetInstance()->add - (this); + PconnModule::GetInstance()->add(this); +} + +PconnPool::~PconnPool() +{ + descr = NULL; + hashFreeMemory(table); } void PconnPool::push(int fd, const char *host, u_short port, const char *domain, IpAddress &client_address) { - IdleConnList *list; const char *aKey; LOCAL_ARRAY(char, desc, FD_DESC_SZ); diff --git a/src/pconn.h b/src/pconn.h index 60df8551a4..735cfdf95d 100644 --- a/src/pconn.h +++ b/src/pconn.h @@ -70,6 +70,7 @@ class PconnPool public: PconnPool(const char *); + ~PconnPool(); void moduleInit(); void push(int fd, const char *host, u_short port, const char *domain, IpAddress &client_address);