From 96d6a56d7f35da5d1ba74ea5e66d732f50818bc9 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Thu, 19 Feb 2009 15:17:28 +1300 Subject: [PATCH] Memory leak on PconnPools Need to free the Pconn hash table properly. constructor/desctructor are both required. --- src/pconn.cc | 10 +++++++--- src/pconn.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/pconn.cc b/src/pconn.cc index 1412083a13..7243c4f495 100644 --- a/src/pconn.cc +++ b/src/pconn.cc @@ -235,15 +235,19 @@ 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, struct IN_ADDR *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 98f7ae286a..1bff65f14a 100644 --- a/src/pconn.h +++ b/src/pconn.h @@ -46,6 +46,7 @@ class PconnPool public: PconnPool(const char *); + ~PconnPool(); void moduleInit(); void push(int fd, const char *host, u_short port, const char *domain, struct IN_ADDR *client_address); -- 2.47.2