Yet another possible segfault path in the backends fixed. I don't
[u/mdw/putty] / ssh.c
diff --git a/ssh.c b/ssh.c
index 4535488..e2c2d73 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -1478,8 +1478,10 @@ static int ssh_closing(Plug plug, char *error_msg, int error_code,
                       int calling_back)
 {
     ssh_state = SSH_STATE_CLOSED;
-    sk_close(s);
-    s = NULL;
+    if (s) {
+        sk_close(s);
+        s = NULL;
+    }
     if (error_msg) {
        /* A socket error has occurred. */
        connection_fatal(error_msg);