From: Eduard Bagdasaryan Date: Wed, 13 Jan 2016 10:29:32 +0000 (+1300) Subject: Bug 4378: assertion failed: DestinationIp.cc:60: 'checklist->conn() && checklist... X-Git-Tag: SQUID_4_0_5~41 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6cf166fc047091e26d8293e82ed2d241d355c1b2;p=thirdparty%2Fsquid.git Bug 4378: assertion failed: DestinationIp.cc:60: 'checklist->conn() && checklist->conn()->clientConnection != NULL' --- diff --git a/src/acl/DestinationIp.cc b/src/acl/DestinationIp.cc index fb12a5a5c8..4b70d14733 100644 --- a/src/acl/DestinationIp.cc +++ b/src/acl/DestinationIp.cc @@ -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)) { diff --git a/src/acl/FilledChecklist.cc b/src/acl/FilledChecklist.cc index 22b88f1670..d8de352919 100644 --- a/src/acl/FilledChecklist.cc +++ b/src/acl/FilledChecklist.cc @@ -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; }