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

2
ssh.c
View File

@ -2051,6 +2051,7 @@ 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.
*/ */
if (ssh->channels) {
for (i = 0; NULL != (c = index234(ssh->channels, i)); i++) { for (i = 0; NULL != (c = index234(ssh->channels, i)); i++) {
switch (c->type) { switch (c->type) {
case CHAN_X11: case CHAN_X11:
@ -2065,6 +2066,7 @@ static void ssh_do_close(Ssh ssh)
bufchain_clear(&c->v.v2.outbuffer); bufchain_clear(&c->v.v2.outbuffer);
sfree(c); sfree(c);
} }
}
} }
static int ssh_closing(Plug plug, char *error_msg, int error_code, static int ssh_closing(Plug plug, char *error_msg, int error_code,