Check return value of GNUNET_NETWORK_socket_create
authorDavid Barksdale <amatus@amat.us>
Wed, 16 Nov 2016 06:21:31 +0000 (15:21 +0900)
committerDavid Barksdale <amatus@amatus.name>
Thu, 17 Nov 2016 22:11:15 +0000 (16:11 -0600)
src/util/client_new.c

index 593d3a268612d0a60527bc62cad29b0135337e9a..337d0673452f003ea88ab30e99022750a1a5bc43 100644 (file)
@@ -495,11 +495,12 @@ try_unixpath (const char *service_name,
     sock = GNUNET_NETWORK_socket_create (AF_UNIX,
                                          SOCK_STREAM,
                                          0);
-    if ( (GNUNET_OK ==
-          GNUNET_NETWORK_socket_connect (sock,
-                                         (struct sockaddr *) &s_un,
-                                         sizeof (s_un))) ||
-         (EINPROGRESS == errno) )
+    if ( (NULL != sock) &&
+         ( (GNUNET_OK ==
+            GNUNET_NETWORK_socket_connect (sock,
+                                           (struct sockaddr *) &s_un,
+                                           sizeof (s_un))) ||
+           (EINPROGRESS == errno) ) )
     {
       LOG (GNUNET_ERROR_TYPE_DEBUG,
            "Successfully connected to unixpath `%s'!\n",