]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Oops.. the previous bugfix to plug leaks on errors did it too well,
authorhno <>
Sat, 27 Oct 2001 05:11:56 +0000 (05:11 +0000)
committerhno <>
Sat, 27 Oct 2001 05:11:56 +0000 (05:11 +0000)
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.

src/client_side.cc

index 5de622bd8571435d94ea16b8c0e818982cacc865..c4835fecaec7eff94f7bf6ef9cf1098b9b862a6a 100644 (file)
@@ -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");