Fixed potential NULL dereference.
authoranryko <a.shvenke@gmail.com>
Sun, 7 Jan 2018 14:43:29 +0000 (15:43 +0100)
committeranryko <a.shvenke@gmail.com>
Sun, 7 Jan 2018 14:43:29 +0000 (15:43 +0100)
src/nat/gnunet-nat.c

index b3cf2e9469c50eddd9196ba1baa949a0f81e76e8..72f34362733fd5a65db13ceabcb3b8cddf7979bc 100644 (file)
@@ -377,10 +377,16 @@ run (void *cls,
     ls = GNUNET_NETWORK_socket_create (af,
                                       SOCK_DGRAM,
                                       IPPROTO_UDP);
+    if (NULL == ls)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
+      "Failed to create socket\n");
+      goto fail_and_shutdown;
+    }
     if (GNUNET_OK !=
-       GNUNET_NETWORK_socket_bind (ls,
-                                   local_sa,
-                                   local_len))
+        GNUNET_NETWORK_socket_bind (ls,
+                                    local_sa,
+                                    local_len))
     {
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                  "Failed to bind to %s: %s\n",