From f92c24a77fe00db9547cffa5e3d7defc3d831292 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 15 Jul 2011 09:06:53 +0000 Subject: [PATCH] leakfix --- src/util/client.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/util/client.c b/src/util/client.c index 629e8c872..e17797042 100644 --- a/src/util/client.c +++ b/src/util/client.c @@ -275,11 +275,12 @@ do_connect (const char *service_name, if (0 == (attempt % 2)) { /* on even rounds, try UNIX */ - if ((GNUNET_OK == - GNUNET_CONFIGURATION_get_value_string (cfg, - service_name, - "UNIXPATH", &unixpath)) && - (0 < strlen (unixpath))) /* We have a non-NULL unixpath, does that mean it's valid? */ + unixpath = NULL; + if ( (GNUNET_OK == + GNUNET_CONFIGURATION_get_value_string (cfg, + service_name, + "UNIXPATH", &unixpath)) && + (0 < strlen (unixpath)) ) /* We have a non-NULL unixpath, does that mean it's valid? */ { sock = GNUNET_CONNECTION_create_from_connect_to_unixpath (cfg, unixpath); if (sock != NULL) @@ -325,21 +326,23 @@ do_connect (const char *service_name, if (0 != (attempt % 2)) { /* try UNIX */ - if ((GNUNET_OK == - GNUNET_CONFIGURATION_get_value_string (cfg, - service_name, - "UNIXPATH", &unixpath)) && - (0 < strlen (unixpath))) + unixpath = NULL; + if ( (GNUNET_OK == + GNUNET_CONFIGURATION_get_value_string (cfg, + service_name, + "UNIXPATH", &unixpath)) && + (0 < strlen (unixpath))) { sock = GNUNET_CONNECTION_create_from_connect_to_unixpath (cfg, unixpath); - GNUNET_free (unixpath); if (sock != NULL) { + GNUNET_free (unixpath); GNUNET_free (hostname); return sock; } } + GNUNET_free_non_null (unixpath); } #endif #if DEBUG_CLIENT -- 2.25.1