]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
When iterating over all channels for a dead SSH connection, don't miss out
authorJacob Nevins <jacobn@chiark.greenend.org.uk>
Mon, 3 Jan 2011 16:50:41 +0000 (16:50 +0000)
committerJacob Nevins <jacobn@chiark.greenend.org.uk>
Mon, 3 Jan 2011 16:50:41 +0000 (16:50 +0000)
those in the CHAN_SOCKDATA_DORMANT state (i.e., local-to-remote forwardings
which the SSH server had not yet acknowledged).
Marcel Kilgus has been running with the ssh_do_close() patch for nearly two
years (*cough*) and reports that it has eliminated frequent
'unclean-close-crash' symptoms for him (due to the unclosed socket generating
a pfd_closing() which accessed freed memory), although I've not reproduced
that. The patch to ssh_free() is mine and not known to fix any symptoms.

[originally from svn r9069]
[this svn revision also touched putty-wishlist]

ssh.c

diff --git a/ssh.c b/ssh.c
index 0a485da211e0d474eed7b1be59e93e966efa4a08..a7f1c6b28ed69d291a35cfec5fb0c3d440f820bb 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -2862,6 +2862,7 @@ static int ssh_do_close(Ssh ssh, int notify_exit)
                x11_close(c->u.x11.s);
                break;
              case CHAN_SOCKDATA:
+             case CHAN_SOCKDATA_DORMANT:
                pfd_close(c->u.pfd.s);
                break;
            }
@@ -9357,6 +9358,7 @@ static void ssh_free(void *handle)
                    x11_close(c->u.x11.s);
                break;
              case CHAN_SOCKDATA:
+             case CHAN_SOCKDATA_DORMANT:
                if (c->u.pfd.s != NULL)
                    pfd_close(c->u.pfd.s);
                break;