From: Christian Grothoff Date: Mon, 25 Jun 2018 18:12:58 +0000 (+0200) Subject: fix memory leak X-Git-Tag: v0.11.0~347 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=9be428429d2b3a11423df18d3e2d27f24bbe4458;p=oweals%2Fgnunet.git fix memory leak --- diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c index 16b826ee2..532a5a0d6 100644 --- a/src/util/gnunet-config.c +++ b/src/util/gnunet-config.c @@ -75,20 +75,29 @@ print_option (void *cls, const char *option, const char *value) { - (void) section; const struct GNUNET_CONFIGURATION_Handle *cfg = cls; - char *value_fn; + + (void) section; if (is_filename) { + char *value_fn; + char *fn; + GNUNET_assert (GNUNET_OK == - GNUNET_CONFIGURATION_get_value_filename (cfg, - section, - option, - &value_fn)); + GNUNET_CONFIGURATION_get_value_filename (cfg, + section, + option, + &value_fn)); + fn = GNUNET_STRINGS_filename_expand (value_fn); + if (NULL == fn) + fn = value_fn; + else + GNUNET_free (value_fn); fprintf (stdout, - "%s = %s\n", - option, - GNUNET_STRINGS_filename_expand (value_fn)); + "%s = %s\n", + option, + fn); + GNUNET_free (fn); } else {