Commits

Anonymous committed 2cf8568

Fix potential segfault in port forwarding code

Comments (0)

Files changed (1)

  */
 void pfd_send(Socket s, char *data, int len)
 {
-    struct PFwdPrivate *pr = (struct PFwdPrivate *) sk_get_private_ptr(s);
-
     if (s == NULL)
 	return;
 
 
 void pfd_confirm(Socket s)
 {
-    struct PFwdPrivate *pr = (struct PFwdPrivate *) sk_get_private_ptr(s);
+    struct PFwdPrivate *pr;
 
     if (s == NULL)
 	return;
 
+    pr = (struct PFwdPrivate *) sk_get_private_ptr(s);
     pr->ready = 1;
     sk_set_frozen(s, 0);
     sk_write(s, NULL, 0);