diff --git a/ssh.c b/ssh.c index 48b3f38f..093c40ec 100644 --- a/ssh.c +++ b/ssh.c @@ -3287,6 +3287,14 @@ static int ssh_do_close(Ssh ssh, int notify_exit) ssh->portfwds = NULL; } + /* + * Also stop attempting to connection-share. + */ + if (ssh->connshare) { + sharestate_free(ssh->connshare); + ssh->connshare = NULL; + } + return ret; }