From: Amos Jeffries Date: Sat, 17 Jul 2010 01:05:16 +0000 (+1200) Subject: Fix crash on forwarding abort X-Git-Tag: take08~55^2~124^2~119 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cff02fa6538ee877ff6aa394f84535a1f47ffc76;p=thirdparty%2Fsquid.git Fix crash on forwarding abort --- diff --git a/src/forward.cc b/src/forward.cc index 1cc2c240d8..9c6981c36e 100644 --- a/src/forward.cc +++ b/src/forward.cc @@ -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();