Yet another possible segfault path in the backends fixed. I don't
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 31 Jul 2001 14:23:21 +0000 (14:23 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 31 Jul 2001 14:23:21 +0000 (14:23 +0000)
_believe_ I'm still finding these. I have no idea what I was
thinking when I wrote this stuff.

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

raw.c
rlogin.c
ssh.c
telnet.c

diff --git a/raw.c b/raw.c
index f5b93f7..86fd531 100644 (file)
--- a/raw.c
+++ b/raw.c
@@ -23,8 +23,10 @@ static void c_write(char *buf, int len)
 static int raw_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);
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);
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);
index b00a6da..04cbec0 100644 (file)
--- a/telnet.c
+++ b/telnet.c
@@ -565,8 +565,10 @@ static void do_telnet_read(char *buf, int len)
 static int telnet_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);