Close on exit. I'm not entirely happy with the distribution of this
[u/mdw/putty] / ssh.c
diff --git a/ssh.c b/ssh.c
index 72f142f..b9d906d 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -2383,7 +2383,8 @@ static void ssh_process_queued_incoming_data(Ssh ssh)
 
 static void ssh_set_frozen(Ssh ssh, int frozen)
 {
-    sk_set_frozen(ssh->s, frozen);
+    if (ssh->s)
+       sk_set_frozen(ssh->s, frozen);
     ssh->frozen = frozen;
 }
 
@@ -2932,6 +2933,7 @@ static int do_ssh1_login(Ssh ssh, unsigned char *in, int inlen,
         if (s->dlgret == 0) {
             ssh->close_expected = TRUE;
             ssh_closing((Plug)ssh, NULL, 0, 0);
+           crStop(0);
         }
     }
 
@@ -3012,6 +3014,7 @@ static int do_ssh1_login(Ssh ssh, unsigned char *in, int inlen,
            if (s->dlgret == 0) {
                ssh->close_expected = TRUE;
                ssh_closing((Plug)ssh, NULL, 0, 0);
+               crStop(0);
            }
         }
     }
@@ -5219,6 +5222,7 @@ static int do_ssh2_transport(Ssh ssh, void *vin, int inlen,
            if (s->dlgret == 0) {
                ssh->close_expected = TRUE;
                ssh_closing((Plug)ssh, NULL, 0, 0);
+               crStop(0);
            }
        }
 
@@ -5243,6 +5247,7 @@ static int do_ssh2_transport(Ssh ssh, void *vin, int inlen,
            if (s->dlgret == 0) {
                ssh->close_expected = TRUE;
                ssh_closing((Plug)ssh, NULL, 0, 0);
+               crStop(0);
            }
        }
 
@@ -5267,6 +5272,7 @@ static int do_ssh2_transport(Ssh ssh, void *vin, int inlen,
            if (s->dlgret == 0) {
                ssh->close_expected = TRUE;
                ssh_closing((Plug)ssh, NULL, 0, 0);
+               crStop(0);
            }
        }