The xfer mechanism wasn't gracefully terminating when an error was
[u/mdw/putty] / ssh.c
diff --git a/ssh.c b/ssh.c
index e0facac..0377e9a 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -7235,12 +7235,14 @@ static void ssh_free(void *handle)
            sfree(c);
        }
        freetree234(ssh->channels);
+       ssh->channels = NULL;
     }
 
     if (ssh->rportfwds) {
        while ((pf = delpos234(ssh->rportfwds, 0)) != NULL)
            sfree(pf);
        freetree234(ssh->rportfwds);
+       ssh->rportfwds = NULL;
     }
     sfree(ssh->deferred_send_data);
     if (ssh->x11auth)
@@ -7256,9 +7258,9 @@ static void ssh_free(void *handle)
     if (ssh->s)
        ssh_do_close(ssh);
     expire_timer_context(ssh);
-    sfree(ssh);
     if (ssh->pinger)
        pinger_free(ssh->pinger);
+    sfree(ssh);
 
     random_unref();
 }