From: Alex Rousskov Date: Sun, 19 May 2013 03:46:58 +0000 (-0600) Subject: Allocate ClientInfo::hash.key using malloc() instead of new char[] X-Git-Tag: SQUID_3_2_12~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3674d3aa7c426c5ebfb7227dc7ba2553f300d96e;p=thirdparty%2Fsquid.git Allocate ClientInfo::hash.key using malloc() instead of new char[] ... because it is destroyed using safe_free() instead of delete[]. Added ClientInfo construction/destruction debugging to find leaking objects. --- diff --git a/src/client_db.cc b/src/client_db.cc index c8456cebd8..e034b1323b 100644 --- a/src/client_db.cc +++ b/src/client_db.cc @@ -72,8 +72,9 @@ static ClientInfo * clientdbAdd(const Ip::Address &addr) { ClientInfo *c; - char *buf = new char[MAX_IPSTRLEN]; + char *buf = static_cast(xmalloc(MAX_IPSTRLEN)); // becomes hash.key c = (ClientInfo *)memAllocate(MEM_CLIENT_INFO); + debugs(77, 9, "ClientInfo constructed, this=" << c); c->hash.key = addr.NtoA(buf,MAX_IPSTRLEN); c->addr = addr; #if USE_DELAY_POOLS @@ -355,6 +356,7 @@ clientdbFreeItem(void *data) } #endif + debugs(77, 9, "ClientInfo destructed, this=" << c); memFree(c, MEM_CLIENT_INFO); }