diff options
author | grothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96> | 2011-02-23 09:22:37 +0000 |
---|---|---|
committer | grothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96> | 2011-02-23 09:22:37 +0000 |
commit | 307e21c6baefff0f347d19ef5d333d9a45607596 (patch) | |
tree | 5ca1a31927486dfd3269364d2370b133c709953b /src/util/service.c | |
parent | 207e762205aa503904b59b8ccd62f739ff8edcfd (diff) |
fix leak
git-svn-id: https://gnunet.org/svn/gnunet@14493 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/util/service.c')
-rw-r--r-- | src/util/service.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/src/util/service.c b/src/util/service.c index 792a802ef8..5937a4c49d 100644 --- a/src/util/service.c +++ b/src/util/service.c @@ -894,9 +894,10 @@ GNUNET_SERVICE_get_server_addresses (const char *serviceName, 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 @@ GNUNET_SERVICE_get_server_addresses (const char *serviceName, /* 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 @@ GNUNET_SERVICE_get_server_addresses (const char *serviceName, desc = NULL; } } - else - unixpath = NULL; -#else - unixpath = NULL; #endif if ( (port == 0) && @@ -965,7 +962,7 @@ GNUNET_SERVICE_get_server_addresses (const char *serviceName, 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 @@ GNUNET_SERVICE_get_server_addresses (const char *serviceName, _("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 @@ GNUNET_SERVICE_get_server_addresses (const char *serviceName, disablev6 ? "IPv4 " : "", hostname); freeaddrinfo (res); GNUNET_free (hostname); - GNUNET_free (unixpath); + GNUNET_free_non_null (unixpath); return GNUNET_SYSERR; } resi = i; |