]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix crash on forwarding abort
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 17 Jul 2010 01:05:16 +0000 (13:05 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 17 Jul 2010 01:05:16 +0000 (13:05 +1200)
src/forward.cc

index 1cc2c240d8f3bdbc48aacae787780482106dccbe..9c6981c36e826759df3cb69a550064d1d2da2abc 100644 (file)
@@ -80,7 +80,11 @@ FwdState::abort(void* d)
     FwdState* fwd = (FwdState*)d;
     Pointer tmp = fwd; // Grab a temporary pointer to keep the object alive during our scope.
 
-    fwd->paths[0]->close();
+    if (fwd->paths.size() > 0 && fwd->paths[0]->fd > -1) {
+        comm_remove_close_handler(fwd->paths[0]->fd, fwdServerClosedWrapper, fwd);
+        fwd->paths[0]->close();
+    }
+    fwd->paths.clean();
     fwd->self = NULL;
 }
 
@@ -167,7 +171,7 @@ FwdState::~FwdState()
 
     entry = NULL;
 
-    if (paths[0]->fd > -1) {
+    if (paths.size() > 0 && paths[0]->fd > -1) {
         comm_remove_close_handler(paths[0]->fd, fwdServerClosedWrapper, this);
         debugs(17, 3, HERE << "closing FD " << paths[0]->fd);
         paths[0]->close();