connection_fatal() should be called after ssh_closing() and other accesses to
authorjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Mon, 16 May 2005 14:41:08 +0000 (14:41 +0000)
committerjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Mon, 16 May 2005 14:41:08 +0000 (14:41 +0000)
`ssh', since it potentially frees it and potentially doesn't return.
Only affected a couple of rare circumstances.

git-svn-id: svn://svn.tartarus.org/sgt/putty@5787 cda61777-01e9-0310-a592-d414129be87e

ssh.c

diff --git a/ssh.c b/ssh.c
index 69972e4..605e0e6 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -3514,9 +3514,9 @@ static int do_ssh1_login(Ssh ssh, unsigned char *in, int inlen,
                            PKT_STR, "No more passwords available to try",
                            PKT_END);
                logevent("Unable to authenticate");
-               connection_fatal(ssh->frontend, "Unable to authenticate");
                ssh->close_expected = TRUE;
-                ssh_closing((Plug)ssh, NULL, 0, 0);
+               ssh_closing((Plug)ssh, NULL, 0, 0);
+               connection_fatal(ssh->frontend, "Unable to authenticate");
                crStop(1);
            }
        } else {
@@ -6137,9 +6137,9 @@ static void ssh2_msg_channel_request(Ssh ssh, struct Packet *pktin)
        ssh2_pkt_addstring(pktout, buf);
        ssh2_pkt_addstring(pktout, "en");       /* language tag */
        ssh2_pkt_send_noqueue(ssh, pktout);
-       connection_fatal(ssh->frontend, "%s", buf);
        ssh->close_expected = TRUE;
        ssh_closing((Plug)ssh, NULL, 0, 0);
+       connection_fatal(ssh->frontend, "%s", buf);
        return;
     }
 
@@ -7108,10 +7108,10 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen,
                        ssh2_pkt_addstring(s->pktout, "en");    /* language tag */
                        ssh2_pkt_send_noqueue(ssh, s->pktout);
                        logevent("Unable to authenticate");
+                       ssh->close_expected = TRUE;
+                       ssh_closing((Plug)ssh, NULL, 0, 0);
                        connection_fatal(ssh->frontend,
                                         "Unable to authenticate");
-                       ssh->close_expected = TRUE;
-                        ssh_closing((Plug)ssh, NULL, 0, 0);
                        crStopV;
                    }
                } else {