Hi,
I'd like to commit this to the squid-3 tree.
Can those who are seeing some memory leaks please update and
apply this patch?
Adrian
Index: comm.cc
===================================================================
RCS file: /server/cvs-server/squid/squid3/src/comm.cc,v
retrieving revision 1.391
diff -u -r1.391 comm.cc
--- comm.cc 20 Oct 2003 12:33:01 -0000 1.391
+++ comm.cc 17 Feb 2004 04:20:03 -0000
@@ -1302,7 +1302,7 @@
cs->fd = fd;
cs->host = xstrdup(host);
cs->port = port;
- cs->callback = CallBack<CNCB>(callback,cbdataReference(data));
+ cs->callback = CallBack<CNCB>(callback, data);
comm_add_close_handler(fd, commConnectFree, cs);
cs->locks++;
ipcache_nbgethostbyname(host, commConnectDnsHandle, cs);
@@ -1345,11 +1345,9 @@
callback = CallBack<CNCB>();
commSetTimeout(fd, -1, NULL, NULL);
- if (cbdataReferenceValid(aCallback.data))
+ if (aCallback.dataValid())
aCallback.handler(fd, status, xerrno, aCallback.data);
- cbdataReferenceDone(aCallback.data);
-
commConnectFree(fd, this);
}
@@ -1358,7 +1356,7 @@
{
ConnectStateData *cs = (ConnectStateData *)data;
debug(5, 3) ("commConnectFree: FD %d\n", fd);
- cbdataReferenceDone(cs->callback.data);
+ cs->callback = CallBack<CNCB>();
safe_free(cs->host);
delete cs;
}
@@ -2557,7 +2555,9 @@
void
commMarkHalfClosed(int fd) {
- assert (fdc_table[fd].active && !fdc_table[fd].half_closed);
+ if (! (fdc_table[fd].active && !fdc_table[fd].half_closed)) {
+ fatal("badness");
+ }
AbortChecker::Instance().monitor(fd);
fdc_table[fd].half_closed = true;
}
Index: CommRead.h
===================================================================
RCS file: /server/cvs-server/squid/squid3/src/CommRead.h,v
retrieving revision 1.5
diff -u -r1.5 CommRead.h
--- CommRead.h 10 Jul 2003 09:37:56 -0000 1.5
+++ CommRead.h 17 Feb 2004 04:20:03 -0000
@@ -79,6 +79,10 @@
return *this;
}
+ bool dataValid()
+ {
+ return cbdataReferenceValid(data);
+ }
bool operator == (CallBack const &rhs) { return handler==rhs.handler &&
data==rhs.data;}