1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 09:58:01 +00:00

The new ssh_do_close() function itself causes a segfault if the

connection goes foom before ssh->channels is set up. Oops. Fixed.

[originally from svn r3141]
This commit is contained in:
Simon Tatham 2003-04-25 17:44:09 +00:00
parent c1d61052ae
commit 1f9c9bb00f

26
ssh.c
View File

@ -2051,19 +2051,21 @@ static void ssh_do_close(Ssh ssh)
* Now we must shut down any port and X forwardings going * Now we must shut down any port and X forwardings going
* through this connection. * through this connection.
*/ */
for (i = 0; NULL != (c = index234(ssh->channels, i)); i++) { if (ssh->channels) {
switch (c->type) { for (i = 0; NULL != (c = index234(ssh->channels, i)); i++) {
case CHAN_X11: switch (c->type) {
x11_close(c->u.x11.s); case CHAN_X11:
break; x11_close(c->u.x11.s);
case CHAN_SOCKDATA: break;
pfd_close(c->u.pfd.s); case CHAN_SOCKDATA:
break; pfd_close(c->u.pfd.s);
break;
}
del234(ssh->channels, c);
if (ssh->version == 2)
bufchain_clear(&c->v.v2.outbuffer);
sfree(c);
} }
del234(ssh->channels, c);
if (ssh->version == 2)
bufchain_clear(&c->v.v2.outbuffer);
sfree(c);
} }
} }