Colin's and my fixes to connection_fatal().
[u/mdw/putty] / x11fwd.c
index 914f3f0..3193175 100644 (file)
--- 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.
@@ -385,7 +385,7 @@ int x11_send(Socket s, char *data, int len)
        pr->auth_dsize = (pr->auth_dlen + 3) & ~3;
        /* Leave room for a terminating zero, to make our lives easier. */
        pr->auth_protocol = snewn(pr->auth_psize + 1, char);
-       pr->auth_data = snewn(pr->auth_dsize, char);
+       pr->auth_data = snewn(pr->auth_dsize, unsigned char);
     }
 
     /*