]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix context leak in HttpStateData::processReplyHeader
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 28 Jun 2010 05:13:07 +0000 (17:13 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 28 Jun 2010 05:13:07 +0000 (17:13 +1200)
src/http.cc

index 132332a4355dc3bcdf589ca287d06f0447ca3726..2b2f1f683f949dab71da4991b0e5471c175b1ee9 100644 (file)
@@ -653,13 +653,18 @@ void
 HttpStateData::processReplyHeader()
 {
     /** Creates a blank header. If this routine is made incremental, this will not do */
+
+    /* NP: all exit points to this function MUST call ctx_exit(ctx) */
     Ctx ctx = ctx_enter(entry->mem_obj->url);
+
     debugs(11, 3, "processReplyHeader: key '" << entry->getMD5Text() << "'");
 
     assert(!flags.headers_parsed);
 
-    if (!readBuf->hasContent())
+    if (!readBuf->hasContent()) {
+        ctx_exit(ctx);
         return;
+    }
 
     http_status error = HTTP_STATUS_NONE;
 
@@ -745,7 +750,6 @@ HttpStateData::processReplyHeader()
     orig_request->hier.peer_reply_status = newrep->sline.status;
 
     ctx_exit(ctx);
-
 }
 
 /**