--------------------- PatchSet 5021 Date: 2002/09/17 14:27:02 Author: rbcollins Branch: fixrange Tag: (none) Log: extract memory freeing from httpRequestFree Members: src/client_side.c:1.72.2.13->1.72.2.14 Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.72.2.13 retrieving revision 1.72.2.14 diff -u -r1.72.2.13 -r1.72.2.14 --- squid/src/client_side.c 17 Sep 2002 14:17:51 -0000 1.72.2.13 +++ squid/src/client_side.c 17 Sep 2002 14:27:02 -0000 1.72.2.14 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.72.2.13 2002/09/17 14:17:51 rbcollins Exp $ + * $Id: client_side.c,v 1.72.2.14 2002/09/17 14:27:02 rbcollins Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -138,8 +138,7 @@ static MemObject *clientGetMemObject (clientHttpRequest *http); static void clientPrepareLogWithRequestDetails (request_t *, AccessLogEntry *); static void clientLogRequest(clientHttpRequest *); - - +static void httpRequestFreeResources(clientHttpRequest *); clientStreamNode * getTail (clientSocketContext *context) @@ -348,17 +347,26 @@ clientdbUpdate(http->conn->peer.sin_addr, http->logType, PROTO_HTTP, http->out.size); } - +} + +void +httpRequestFreeResources(clientHttpRequest *http) +{ + safe_free(http->uri); + safe_free(http->log_uri); + safe_free(http->redirect.location); + requestUnlink(http->request); + http->request = NULL; + if (http->client_stream.tail) + clientStreamAbort(http->client_stream.tail->data, http); } void httpRequestFree(void *data) { clientHttpRequest *http = data; - ConnStateData *conn; request_t *request = NULL; assert(http != NULL); - conn = http->conn; request = http->request; debug(33, 3) ("httpRequestFree: %s\n", http->uri); /* FIXME: This needs to use the stream */ @@ -376,13 +384,7 @@ clientLogRequest (http); if (request) checkFailureRatio(request->errType, http->al.hier.code); - safe_free(http->uri); - safe_free(http->log_uri); - accessLogFreeMemory(&http->al); - safe_free(http->redirect.location); - requestUnlink(http->request); - if (http->client_stream.tail) - clientStreamAbort(http->client_stream.tail->data, http); + httpRequestFreeResources(http); /* moving to the next connection is handled by the context free */ dlinkDelete(&http->active, &ClientActiveRequests); cbdataFree(http);