From c1d61052aeffb64cb1c4202ae55268d77f43cee3 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Fri, 25 Apr 2003 16:42:36 +0000 Subject: [PATCH] Fix another segfault on abrupt X connection shutdown. This should have happened in rev 1.5 [r996] but didn't! Now we never call sk_get_private_ptr() on a socket unless we've ensured it's non-NULL. [originally from svn r3140] [r996 == 7b0e082700583907770555212db89299e5f51a44] --- x11fwd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x11fwd.c b/x11fwd.c index 91d68d24..31931752 100644 --- a/x11fwd.c +++ b/x11fwd.c @@ -361,10 +361,10 @@ void x11_override_throttle(Socket s, int enable) */ int x11_send(Socket s, char *data, int len) { - struct X11Private *pr = (struct X11Private *) sk_get_private_ptr(s); - - if (s == NULL) + struct X11Private *pr; + if (!s) return 0; + pr = (struct X11Private *) sk_get_private_ptr(s); /* * Read the first packet.