From 9790b54b1343f6bdc051210360b31533c94271f1 Mon Sep 17 00:00:00 2001 From: Eduard Bagdasaryan Date: Sun, 31 Jan 2016 18:22:31 +1300 Subject: [PATCH] Bug 4378: assertion failed: DestinationIp.cc:60: 'checklist->conn() && checklist->conn()->clientConnection != NULL' --- src/acl/DestinationIp.cc | 5 +++-- src/acl/FilledChecklist.cc | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/acl/DestinationIp.cc b/src/acl/DestinationIp.cc index 00e027e493..aa316f8913 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 ConnStateData *conn = checklist->conn(); + return (conn != NULL && conn->clientConnection != NULL) ? + 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 f390c1868c..f2f5179f24 100644 --- a/src/acl/FilledChecklist.cc +++ b/src/acl/FilledChecklist.cc @@ -69,7 +69,7 @@ ACLFilledChecklist::~ACLFilledChecklist() ConnStateData * ACLFilledChecklist::conn() const { - return conn_; + return cbdataReferenceValid(conn_) ? conn_ : NULL; } void @@ -84,13 +84,15 @@ ACLFilledChecklist::conn(ConnStateData *aConn) int ACLFilledChecklist::fd() const { - return (conn_ != NULL && conn_->clientConnection != NULL) ? conn_->clientConnection->fd : fd_; + const ConnStateData *c = conn(); + return (c != NULL && c->clientConnection != NULL) ? c->clientConnection->fd : fd_; } void ACLFilledChecklist::fd(int aDescriptor) { - assert(!conn() || conn()->clientConnection == NULL || conn()->clientConnection->fd == aDescriptor); + const ConnStateData *c = conn(); + assert(!c || !c->clientConnection || c->clientConnection->fd == aDescriptor); fd_ = aDescriptor; } -- 2.47.2