]> asedeno.scripts.mit.edu Git - PuTTY_svn.git/commitdiff
Yet another possible segfault path in the backends fixed. I don't
authorSimon Tatham <anakin@pobox.com>
Tue, 31 Jul 2001 14:23:21 +0000 (14:23 +0000)
committerSimon Tatham <anakin@pobox.com>
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: http://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 f5b93f79a06b4f3ae787c76f4172243798832494..86fd5315cd282ddb4644e4b80668607c5a6d8331 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 3ae18089c1c1ae2516e819721fa5d4f517a35945..8010852710b7c48a84270be9e7aac1c135b1faa1 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 45354884bc8c5043ff283cb97f8408d43650c32f..e2c2d73726fcbbcb459c8dba94a462c774a1e9b1 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 b00a6da0c0519585da8fa03f0782e8cd48040153..04cbec02a4b25f5267993849fbd81aa06e5b3ef3 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);