--------------------- PatchSet 1851 Date: 2005/09/19 20:48:33 Author: dwsquid Branch: squid3-icap Tag: (none) Log: Fixed a memory leak Members: src/ICAPClientSideHook.cc:1.1.2.4->1.1.2.5 src/client_side_request.cc:1.34.4.4->1.34.4.5 Index: squid3/src/ICAPClientSideHook.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ICAPClientSideHook.cc,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -r1.1.2.4 -r1.1.2.5 --- squid3/src/ICAPClientSideHook.cc 19 Sep 2005 18:00:09 -0000 1.1.2.4 +++ squid3/src/ICAPClientSideHook.cc 19 Sep 2005 20:48:33 -0000 1.1.2.5 @@ -195,8 +195,8 @@ void ICAPClientSideHook::freeVirgin() { - requestUnlink(virgin->data->cause); - virgin->data->cause = NULL; + // virgin->data->cause should be NULL; + requestUnlink(dynamic_cast(virgin->data->header)); virgin->data->header = NULL; leakTouch(virgin.getRaw(), leaky); virgin = NULL; // refcounted Index: squid3/src/client_side_request.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side_request.cc,v retrieving revision 1.34.4.4 retrieving revision 1.34.4.5 diff -u -r1.34.4.4 -r1.34.4.5 --- squid3/src/client_side_request.cc 19 Sep 2005 18:00:09 -0000 1.34.4.4 +++ squid3/src/client_side_request.cc 19 Sep 2005 20:48:33 -0000 1.34.4.5 @@ -1,6 +1,6 @@ /* - * $Id: client_side_request.cc,v 1.34.4.4 2005/09/19 18:00:09 dwsquid Exp $ + * $Id: client_side_request.cc,v 1.34.4.5 2005/09/19 20:48:33 dwsquid Exp $ * * DEBUG: section 85 Client-side Request Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -412,7 +412,7 @@ http->getConn().getRaw() != NULL ? &http->getConn()->peer.sin_addr : &no_addr, http->request, NULL, http->getConn().getRaw() != NULL && http->getConn()->auth_user_request ? http->getConn()-> - auth_user_request : http->request->auth_user_request, 0); + auth_user_request : http->request->auth_user_request); node = (clientStreamNode *)http->client_stream.tail->data; clientStreamRead(node, http, node->readBuffer); } @@ -986,10 +986,18 @@ HttpRequest *request = dynamic_cast(msg); assert(request); - // swap! + /* + * Replace the old request with the new request. First, + * Move the "body_connection" over, then unlink old and + * link new to the http state. + */ + request->body_connection = http->request->body_connection; + http->request->body_connection = NULL; requestUnlink(http->request); http->request = requestLink(request); - // munge! + /* + * Store the new URI for logging + */ xfree(http->uri); http->uri = xstrdup(urlCanonical(request)); setLogUri(http, urlCanonicalClean(request)); @@ -1025,6 +1033,8 @@ debug(33,3)("ClientRequestContext::abortAdapting() called\n"); if ((NULL == http->storeEntry()) || http->storeEntry()->isEmpty()) { debug(33,1)("WARNING: ICAP REQMOD callout failed, proceeding with original request\n"); + delete icap; + icap = NULL; checkNoCache(); #if ICAP_HARD_ERROR clientStreamNode *node = (clientStreamNode *)http->client_stream.tail->prev->data;