------------------------------------------------------------ revno: 14060 revision-id: squid3@treenet.co.nz-20160618114803-m7riuy90mrdlxw1f parent: squidadm@squid-cache.org-20160616001416-jb7a6qq30tm5gpoc fixes bug: http://bugs.squid-cache.org/show_bug.cgi?id=3579 committer: Amos Jeffries branch nick: 3.5 timestamp: Sat 2016-06-18 23:48:03 +1200 message: Bug 3579: assertion failed 'MemPools[type]' from dst_as ACL ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20160618114803-m7riuy90mrdlxw1f # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # testament_sha1: cc798e8d0b4767544c21f3614ce995d435bca867 # timestamp: 2016-06-18 11:50:56 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # base_revision_id: squidadm@squid-cache.org-20160616001416-\ # jb7a6qq30tm5gpoc # # Begin patch === modified file 'src/PeerSelectState.h' --- src/PeerSelectState.h 2016-01-01 00:14:27 +0000 +++ src/PeerSelectState.h 2016-06-18 11:48:03 +0000 @@ -38,11 +38,17 @@ class FwdServer { public: + MEMPROXY_CLASS(FwdServer); + FwdServer(CachePeer *p, hier_code c) : _peer(cbdataReference(p)), code(c), next(NULL) {} + ~FwdServer() {cbdataReferenceDone(_peer);} + CachePeer *_peer; /* NULL --> origin server */ hier_code code; FwdServer *next; }; +MEMPROXY_CLASS_INLINE(FwdServer); + class ps_state { === modified file 'src/enums.h' --- src/enums.h 2016-01-01 00:14:27 +0000 +++ src/enums.h 2016-06-18 11:48:03 +0000 @@ -170,7 +170,6 @@ MEM_DONTFREE, // following pools are initialized late by their component if needed (or never) MEM_FQDNCACHE_ENTRY, - MEM_FWD_SERVER, MEM_IDNS_QUERY, MEM_IPCACHE_ENTRY, MEM_MAX === modified file 'src/peer_select.cc' --- src/peer_select.cc 2016-01-01 00:14:27 +0000 +++ src/peer_select.cc 2016-06-18 11:48:03 +0000 @@ -71,7 +71,7 @@ while (servers) { FwdServer *next = servers->next; cbdataReferenceDone(servers->_peer); - memFree(servers, MEM_FWD_SERVER); + delete servers; servers = next; } @@ -246,7 +246,7 @@ // clear the used fs and continue psstate->servers = fs->next; cbdataReferenceDone(fs->_peer); - memFree(fs, MEM_FWD_SERVER); + delete fs; peerSelectDnsPaths(psstate); return; } @@ -268,7 +268,7 @@ while (fs) { psstate->servers = fs->next; cbdataReferenceDone(fs->_peer); - memFree(fs, MEM_FWD_SERVER); + delete fs; fs = psstate->servers; } } @@ -377,7 +377,7 @@ psstate->servers = fs->next; cbdataReferenceDone(fs->_peer); - memFree(fs, MEM_FWD_SERVER); + delete fs; // see if more paths can be found peerSelectDnsPaths(psstate); @@ -772,7 +772,6 @@ peerSelectInit(void) { memset(&PeerStats, '\0', sizeof(PeerStats)); - memDataInit(MEM_FWD_SERVER, "FwdServer", sizeof(FwdServer), 0); } static void @@ -934,12 +933,10 @@ static void peerAddFwdServer(FwdServer ** FSVR, CachePeer * p, hier_code code) { - FwdServer *fs = (FwdServer *)memAllocate(MEM_FWD_SERVER); debugs(44, 5, "peerAddFwdServer: adding " << (p ? p->host : "DIRECT") << " " << hier_code_str[code] ); - fs->_peer = cbdataReference(p); - fs->code = code; + FwdServer *fs = new FwdServer(p, code); while (*FSVR) FSVR = &(*FSVR)->next;