From: simon Date: Fri, 25 Apr 2003 16:42:36 +0000 (+0000) Subject: Fix another segfault on abrupt X connection shutdown. This should X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/commitdiff_plain/970f2b0214503bd5a4bec9454ebc47de8bdea161?ds=sidebyside 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. git-svn-id: svn://svn.tartarus.org/sgt/putty@3140 cda61777-01e9-0310-a592-d414129be87e --- 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.