]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix context leak in HttpStateData::processReplyHeader
authorAmos Jeffries <amosjeffries@squid-cache.org>
Fri, 2 Jul 2010 01:24:43 +0000 (19:24 -0600)
committerAmos Jeffries <amosjeffries@squid-cache.org>
Fri, 2 Jul 2010 01:24:43 +0000 (19:24 -0600)
src/http.cc

index e213082930015e74e7206ef1551207836864ce0f..6f8b5b45d482bdd7897b465c57e24663a1a696eb 100644 (file)
@@ -656,13 +656,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;
 
@@ -748,7 +753,6 @@ HttpStateData::processReplyHeader()
     orig_request->hier.peer_reply_status = newrep->sline.status;
 
     ctx_exit(ctx);
-
 }
 
 /**