]> granicus.if.org Git - transmission/commitdiff
(trunk, libT) #5157 -- fix r13628 oops
authorJordan Lee <jordan@transmissionbt.com>
Thu, 6 Dec 2012 00:50:40 +0000 (00:50 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Thu, 6 Dec 2012 00:50:40 +0000 (00:50 +0000)
libtransmission/net.c

index d50e365ad3f1107f1dc9809b391b00b5f5d146aa..f68a3594624b32cc1717591474373cdb2a0e141b 100644 (file)
@@ -300,16 +300,16 @@ tr_netOpenPeerUTPSocket (tr_session        * session,
                          tr_port             port,
                          bool                clientIsSeed UNUSED)
 {
-    struct sockaddr_storage ss;
-    socklen_t sslen;
-
-    if (!tr_address_is_valid_for_peers (addr, port))
-        return -EINVAL;
+  struct UTPSocket * ret = NULL;
 
-    sslen = setup_sockaddr (addr, port, &ss);
+  if (tr_address_is_valid_for_peers (addr, port))
+    {
+      struct sockaddr_storage ss;
+      const socklen_t sslen = setup_sockaddr (addr, port, &ss);
+      ret = UTP_Create (tr_utpSendTo, session, (struct sockaddr*)&ss, sslen);
+    }
 
-    return UTP_Create (tr_utpSendTo, (void*)session,
-                     (struct sockaddr*)&ss, sslen);
+  return ret;
 }
 
 static int