Yet another possible segfault path in the backends fixed. I don't
[u/mdw/putty] / rlogin.c
index 3ae1808..8010852 100644 (file)
--- a/rlogin.c
+++ b/rlogin.c
@@ -24,8 +24,10 @@ static void c_write(char *buf, int len)
 static int rlogin_closing(Plug plug, char *error_msg, int error_code,
                          int calling_back)
 {
-    sk_close(s);
-    s = NULL;
+    if (s) {
+        sk_close(s);
+        s = NULL;
+    }
     if (error_msg) {
        /* A socket error has occurred. */
        connection_fatal(error_msg);