From: hno <> Date: Sat, 27 Oct 2001 05:11:56 +0000 (+0000) Subject: Oops.. the previous bugfix to plug leaks on errors did it too well, X-Git-Tag: SQUID_3_0_PRE1~1316 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6792f0d3595988e381bf31855af8bebbc9e9b570;p=thirdparty%2Fsquid.git Oops.. the previous bugfix to plug leaks on errors did it too well, causing some memory to be freed twice. This confusion was caused by some very odd management of the request buffer in clientReadRequest / parseHttpRequest. This patch cleans this up to use a single unified policy. --- diff --git a/src/client_side.cc b/src/client_side.cc index 5de622bd85..c4835fecae 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.555 2001/10/24 07:45:34 hno Exp $ + * $Id: client_side.cc,v 1.556 2001/10/26 23:11:56 hno Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -2439,11 +2439,14 @@ parseHttpRequest(ConnStateData * conn, method_t * method_p, int *status, size_t sock_sz = sizeof(conn->me); #endif + /* pre-set these values to make aborting simpler */ + *prefix_p = NULL; + *method_p = METHOD_NONE; + *status = -1; + if ((req_sz = headersEnd(conn->in.buf, conn->in.offset)) == 0) { debug(33, 5) ("Incomplete request, waiting for end of headers\n"); *status = 0; - *prefix_p = NULL; - *method_p = METHOD_NONE; return NULL; } assert(req_sz <= conn->in.offset); @@ -2452,11 +2455,6 @@ parseHttpRequest(ConnStateData * conn, method_t * method_p, int *status, xmemcpy(inbuf, conn->in.buf, req_sz); *(inbuf + req_sz) = '\0'; - /* pre-set these values to make aborting simpler */ - *prefix_p = inbuf; - *method_p = METHOD_NONE; - *status = -1; - /* Barf on NULL characters in the headers */ if (strlen(inbuf) != req_sz) { debug(33, 1) ("parseHttpRequest: Requestheader contains NULL characters\n");