]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 4378: assertion failed: DestinationIp.cc:60: 'checklist->conn() && checklist...
authorEduard Bagdasaryan <eduard.bagdasaryan@measurement-factory.com>
Wed, 13 Jan 2016 10:29:32 +0000 (23:29 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 13 Jan 2016 10:29:32 +0000 (23:29 +1300)
src/acl/DestinationIp.cc
src/acl/FilledChecklist.cc

index fb12a5a5c88884624e8ec76865ccf006eac5d737..4b70d1473324bf0b0470d814cd8ed9e6e54d7505 100644 (file)
@@ -38,8 +38,9 @@ ACLDestinationIP::match(ACLChecklist *cl)
     // To resolve this we will force DIRECT and only to the original client destination.
     // In which case, we also need this ACL to accurately match the destination
     if (Config.onoff.client_dst_passthru && (checklist->request->flags.intercepted || checklist->request->flags.interceptTproxy)) {
-        assert(checklist->conn() && checklist->conn()->clientConnection != NULL);
-        return ACLIP::match(checklist->conn()->clientConnection->local);
+        const auto conn = checklist->conn();
+        return (conn && conn->clientConnection) ?
+            ACLIP::match(conn->clientConnection->local) : -1;
     }
 
     if (flags.isSet(ACL_F_NO_LOOKUP)) {
index 22b88f1670064e255737835d07322479cc3e0bc2..d8de3529197e292870d03a6ec05b58756120ea70 100644 (file)
@@ -125,7 +125,7 @@ ACLFilledChecklist::syncAle() const
 ConnStateData *
 ACLFilledChecklist::conn() const
 {
-    return  conn_;
+    return cbdataReferenceValid(conn_) ? conn_ : nullptr;
 }
 
 void
@@ -140,13 +140,15 @@ ACLFilledChecklist::conn(ConnStateData *aConn)
 int
 ACLFilledChecklist::fd() const
 {
-    return (conn_ != NULL && conn_->clientConnection != NULL) ? conn_->clientConnection->fd : fd_;
+    const auto c = conn();
+    return (c && c->clientConnection) ? c->clientConnection->fd : fd_;
 }
 
 void
 ACLFilledChecklist::fd(int aDescriptor)
 {
-    assert(!conn() || conn()->clientConnection == NULL || conn()->clientConnection->fd == aDescriptor);
+    const auto c = conn();
+    assert(!c || !c->clientConnection || c->clientConnection->fd == aDescriptor);
     fd_ = aDescriptor;
 }