gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r14493 - gnunet/src/util


From: gnunet
Subject: [GNUnet-SVN] r14493 - gnunet/src/util
Date: Wed, 23 Feb 2011 10:22:37 +0100

Author: grothoff
Date: 2011-02-23 10:22:37 +0100 (Wed, 23 Feb 2011)
New Revision: 14493

Modified:
   gnunet/src/util/service.c
Log:
fix leak

Modified: gnunet/src/util/service.c
===================================================================
--- gnunet/src/util/service.c   2011-02-23 09:11:04 UTC (rev 14492)
+++ gnunet/src/util/service.c   2011-02-23 09:22:37 UTC (rev 14493)
@@ -894,9 +894,10 @@
   else
     hostname = NULL;
 
+  unixpath = NULL;
 #ifdef AF_UNIX
   if ((GNUNET_YES == GNUNET_CONFIGURATION_have_value (cfg,
-                                       serviceName, "UNIXPATH")) &&
+                                                     serviceName, "UNIXPATH")) 
&&
       (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg,
                                                            serviceName,
                                                            "UNIXPATH",
@@ -912,13 +913,13 @@
       /* probe UNIX support */
       struct sockaddr_un s_un;
       if (strlen(unixpath) >= sizeof(s_un.sun_path))
-      {
-         GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                  _("UNIXPATH `%s' too long, maximum length is 
%llu\n"),unixpath, sizeof(s_un.sun_path));
-             GNUNET_free_non_null (hostname);
-             GNUNET_free (unixpath);
-         return GNUNET_SYSERR;
-      }
+       {
+         GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                     _("UNIXPATH `%s' too long, maximum length is 
%llu\n"),unixpath, sizeof(s_un.sun_path));
+         GNUNET_free_non_null (hostname);
+         GNUNET_free (unixpath);
+         return GNUNET_SYSERR;
+       }
 
       desc = GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_STREAM, 0);
       if (NULL == desc)
@@ -944,10 +945,6 @@
           desc = NULL;
        }
     }
-  else
-    unixpath = NULL;
-#else
-  unixpath = NULL;
 #endif
 
   if ( (port == 0) &&
@@ -965,7 +962,7 @@
       saddrlens = GNUNET_malloc (2 * sizeof (socklen_t));
       add_unixpath (saddrs, saddrlens, unixpath);
       GNUNET_free_non_null (unixpath);
-      GNUNET_free_non_null(hostname);
+      GNUNET_free_non_null (hostname);
       *addrs = saddrs;
       *addr_lens = saddrlens;
       return 1;
@@ -989,7 +986,7 @@
                       _("Failed to resolve `%s': %s\n"),
                       hostname, gai_strerror (ret));
           GNUNET_free (hostname);
-         GNUNET_free (unixpath);
+         GNUNET_free_non_null (unixpath);
           return GNUNET_SYSERR;
         }
       next = res;
@@ -1008,7 +1005,7 @@
                       disablev6 ? "IPv4 " : "", hostname);
           freeaddrinfo (res);
           GNUNET_free (hostname);
-         GNUNET_free (unixpath);
+         GNUNET_free_non_null (unixpath);
           return GNUNET_SYSERR;
         }
       resi = i;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]