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

Close the listening socket when a sharing upstream dies.

Without this, doing 'Restart Session' on Windows in a session with
sharing enabled but no actual sharing being done would crash, because
the first incarnation of the session would become an upstream and
establish a listening named pipe, which then wouldn't get cleaned up
when the session closed, so the restarted session would try to connect
to it, triggering a call to plug_accepting on a freed sharestate.

[originally from svn r10216]
This commit is contained in:
Simon Tatham 2014-09-07 13:06:52 +00:00
parent 9fa5b9858c
commit aa62bce083

View File

@ -517,6 +517,10 @@ void sharestate_free(void *v)
share_connstate_free(cs);
}
freetree234(sharestate->connections);
if (sharestate->listensock) {
sk_close(sharestate->listensock);
sharestate->listensock = NULL;
}
sfree(sharestate->server_verstring);
sfree(sharestate->sockname);
sfree(sharestate);
@ -1843,6 +1847,7 @@ static int share_listen_closing(Plug plug, const char *error_msg,
ssh_sharing_logf(sharestate->ssh, 0,
"listening socket: %s", error_msg);
sk_close(sharestate->listensock);
sharestate->listensock = NULL;
return 1;
}