]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3687: unhandled exception: c when using interception and peers
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 1 Feb 2013 04:57:13 +0000 (21:57 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 1 Feb 2013 04:57:13 +0000 (21:57 -0700)
src/peer_select.cc

index d412f61d2c5777b3836008d8246a3c969476adab..fb3f20d775fe5910562e6e93eab38801c03e3de5 100644 (file)
@@ -243,15 +243,18 @@ peerSelectDnsPaths(ps_state *psstate)
     const bool useOriginalDst = Config.onoff.client_dst_passthru || !req->flags.hostVerified;
     const bool choseDirect = fs && fs->code == HIER_DIRECT;
     if (isIntercepted && useOriginalDst && choseDirect) {
-        // construct a "result" adding the ORIGINAL_DST to the set instead of DIRECT
-        Comm::ConnectionPointer p = new Comm::Connection();
-        p->remote = req->clientConnectionManager->clientConnection->local;
-        p->peerType = fs->code;
-        p->setPeer(fs->_peer);
-
-        // check for a configured outgoing address for this destination...
-        getOutgoingAddress(psstate->request, p);
-        psstate->paths->push_back(p);
+        // check the client is still around before using any of its details
+        if (req->clientConnectionManager.valid()) {
+            // construct a "result" adding the ORIGINAL_DST to the set instead of DIRECT
+            Comm::ConnectionPointer p = new Comm::Connection();
+            p->remote = req->clientConnectionManager->clientConnection->local;
+            p->peerType = fs->code;
+            p->setPeer(fs->_peer);
+
+            // check for a configured outgoing address for this destination...
+            getOutgoingAddress(psstate->request, p);
+            psstate->paths->push_back(p);
+        }
 
         // clear the used fs and continue
         psstate->servers = fs->next;