From cff02fa6538ee877ff6aa394f84535a1f47ffc76 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Sat, 17 Jul 2010 13:05:16 +1200 Subject: [PATCH] Fix crash on forwarding abort --- src/forward.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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(); -- 2.47.3