]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Memory leak on PconnPools
authorAmos Jeffries <squid3@treenet.co.nz>
Sun, 15 Feb 2009 13:04:18 +0000 (02:04 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 15 Feb 2009 13:04:18 +0000 (02:04 +1300)
Need to free the Pconn hash table properly.
constructor/desctructor are both required.

src/pconn.cc
src/pconn.h

index 223e8022efb3bff41eeb519342cdd9019744f9fb..59dd417b1c70b4455b75e69244f27746b0102192 100644 (file)
@@ -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);
index 60df8551a4912f46bab7d9e02c479b8f59b52bc6..735cfdf95d193251a9a02e3454bb69440e2d2010 100644 (file)
@@ -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);