]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix memory leak in Surrogate-Capability header detection
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 29 Aug 2015 20:13:41 +0000 (13:13 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 29 Aug 2015 20:13:41 +0000 (13:13 -0700)
 Detected by Coverity Scan. Issue 1318023

src/esi/Esi.cc

index 789003707b409de04c9cc7aa32de35f6c17b5104..f87ce5481e6b6806d5b219c6f1664612be8b3176 100644 (file)
@@ -2408,14 +2408,12 @@ esiEnableProcessing (HttpReply *rep)
         HttpHdrScTarget *sctusable =
             rep->surrogate_control->getMergedTarget(Config.Accel.surrogate_id);
 
-        if (!sctusable || !sctusable->hasContent())
-            /* Nothing generic or targeted at us, or no
-             * content processing requested
-             */
-            return 0;
-
-        if (sctusable->content().pos("ESI/1.0") != NULL)
+        // found something targeted at us
+        if (sctusable &&
+                sctusable->hasContent() &&
+                sctusable->content().pos("ESI/1.0")) {
             rv = 1;
+        }
 
         delete sctusable;
     }