1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00:00

When iterating over all channels for a dead SSH connection, don't miss out

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]
This commit is contained in:
Jacob Nevins 2011-01-03 16:50:41 +00:00
parent a45f984c75
commit 99db81f2e7

2
ssh.c
View File

@ -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;