diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-02-23 09:22:37 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-02-23 09:22:37 +0000 |
commit | 2a70d3f77bdb563c63ff8ffbbb605d418828b0b1 (patch) | |
tree | 5ca1a31927486dfd3269364d2370b133c709953b /src/util | |
parent | 43363280a873427274190f04422931e5959fae6f (diff) | |
download | gnunet-2a70d3f77bdb563c63ff8ffbbb605d418828b0b1.tar.gz gnunet-2a70d3f77bdb563c63ff8ffbbb605d418828b0b1.zip |
fix leak
Diffstat (limited to 'src/util')
-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 792a802ef..5937a4c49 100644 --- a/src/util/service.c +++ b/src/util/service.c | |||
@@ -894,9 +894,10 @@ GNUNET_SERVICE_get_server_addresses (const char *serviceName, | |||
894 | else | 894 | else |
895 | hostname = NULL; | 895 | hostname = NULL; |
896 | 896 | ||
897 | unixpath = NULL; | ||
897 | #ifdef AF_UNIX | 898 | #ifdef AF_UNIX |
898 | if ((GNUNET_YES == GNUNET_CONFIGURATION_have_value (cfg, | 899 | if ((GNUNET_YES == GNUNET_CONFIGURATION_have_value (cfg, |
899 | serviceName, "UNIXPATH")) && | 900 | serviceName, "UNIXPATH")) && |
900 | (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, | 901 | (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, |
901 | serviceName, | 902 | serviceName, |
902 | "UNIXPATH", | 903 | "UNIXPATH", |
@@ -912,13 +913,13 @@ GNUNET_SERVICE_get_server_addresses (const char *serviceName, | |||
912 | /* probe UNIX support */ | 913 | /* probe UNIX support */ |
913 | struct sockaddr_un s_un; | 914 | struct sockaddr_un s_un; |
914 | if (strlen(unixpath) >= sizeof(s_un.sun_path)) | 915 | if (strlen(unixpath) >= sizeof(s_un.sun_path)) |
915 | { | 916 | { |
916 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 917 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
917 | _("UNIXPATH `%s' too long, maximum length is %llu\n"),unixpath, sizeof(s_un.sun_path)); | 918 | _("UNIXPATH `%s' too long, maximum length is %llu\n"),unixpath, sizeof(s_un.sun_path)); |
918 | GNUNET_free_non_null (hostname); | 919 | GNUNET_free_non_null (hostname); |
919 | GNUNET_free (unixpath); | 920 | GNUNET_free (unixpath); |
920 | return GNUNET_SYSERR; | 921 | return GNUNET_SYSERR; |
921 | } | 922 | } |
922 | 923 | ||
923 | desc = GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_STREAM, 0); | 924 | desc = GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_STREAM, 0); |
924 | if (NULL == desc) | 925 | if (NULL == desc) |
@@ -944,10 +945,6 @@ GNUNET_SERVICE_get_server_addresses (const char *serviceName, | |||
944 | desc = NULL; | 945 | desc = NULL; |
945 | } | 946 | } |
946 | } | 947 | } |
947 | else | ||
948 | unixpath = NULL; | ||
949 | #else | ||
950 | unixpath = NULL; | ||
951 | #endif | 948 | #endif |
952 | 949 | ||
953 | if ( (port == 0) && | 950 | if ( (port == 0) && |
@@ -965,7 +962,7 @@ GNUNET_SERVICE_get_server_addresses (const char *serviceName, | |||
965 | saddrlens = GNUNET_malloc (2 * sizeof (socklen_t)); | 962 | saddrlens = GNUNET_malloc (2 * sizeof (socklen_t)); |
966 | add_unixpath (saddrs, saddrlens, unixpath); | 963 | add_unixpath (saddrs, saddrlens, unixpath); |
967 | GNUNET_free_non_null (unixpath); | 964 | GNUNET_free_non_null (unixpath); |
968 | GNUNET_free_non_null(hostname); | 965 | GNUNET_free_non_null (hostname); |
969 | *addrs = saddrs; | 966 | *addrs = saddrs; |
970 | *addr_lens = saddrlens; | 967 | *addr_lens = saddrlens; |
971 | return 1; | 968 | return 1; |
@@ -989,7 +986,7 @@ GNUNET_SERVICE_get_server_addresses (const char *serviceName, | |||
989 | _("Failed to resolve `%s': %s\n"), | 986 | _("Failed to resolve `%s': %s\n"), |
990 | hostname, gai_strerror (ret)); | 987 | hostname, gai_strerror (ret)); |
991 | GNUNET_free (hostname); | 988 | GNUNET_free (hostname); |
992 | GNUNET_free (unixpath); | 989 | GNUNET_free_non_null (unixpath); |
993 | return GNUNET_SYSERR; | 990 | return GNUNET_SYSERR; |
994 | } | 991 | } |
995 | next = res; | 992 | next = res; |
@@ -1008,7 +1005,7 @@ GNUNET_SERVICE_get_server_addresses (const char *serviceName, | |||
1008 | disablev6 ? "IPv4 " : "", hostname); | 1005 | disablev6 ? "IPv4 " : "", hostname); |
1009 | freeaddrinfo (res); | 1006 | freeaddrinfo (res); |
1010 | GNUNET_free (hostname); | 1007 | GNUNET_free (hostname); |
1011 | GNUNET_free (unixpath); | 1008 | GNUNET_free_non_null (unixpath); |
1012 | return GNUNET_SYSERR; | 1009 | return GNUNET_SYSERR; |
1013 | } | 1010 | } |
1014 | resi = i; | 1011 | resi = i; |