From 12586cd08b2d8f797ef1a63501def72d5c875cf8 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 22 Nov 2009 19:06:54 +0000 Subject: [PATCH] fixes --- src/util/test_configuration.c | 12 ++++++++++-- src/util/test_resolver_api.c | 5 ++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/util/test_configuration.c b/src/util/test_configuration.c index 609f797bd..7d87d03a8 100644 --- a/src/util/test_configuration.c +++ b/src/util/test_configuration.c @@ -117,6 +117,8 @@ diffsCallBack (void *cls, { int ret; char *diffValue; + + diffValue = NULL; ret = GNUNET_CONFIGURATION_get_value_string (cbData->cfgDiffs, section, option, &diffValue); @@ -127,6 +129,7 @@ diffsCallBack (void *cls, } else cbData->status = 1; + GNUNET_free_non_null (diffValue); break; } #if DEBUG @@ -180,6 +183,7 @@ editConfiguration (struct GNUNET_CONFIGURATION_Handle *cfg, int option) GNUNET_CONFIGURATION_set_value_string (diffsCB.cfgDiffs, "new-section", key, "new-value"); + GNUNET_free (key); } break; } @@ -209,12 +213,15 @@ checkDiffs (struct GNUNET_CONFIGURATION_Handle *cfgDefault, int option) initDiffsCBData (&cbData); cfg = GNUNET_CONFIGURATION_create (); - GNUNET_CONFIGURATION_load (cfg, NULL); + /* load defaults */ + GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (cfg, NULL)); /* Modify configuration and save it */ cfgDiffs = editConfiguration (cfg, option); diffsFileName = GNUNET_DISK_mktemp ("gnunet-test-configurations-diffs.conf"); + if (diffsFileName == NULL) + return 1; GNUNET_CONFIGURATION_write_diffs (cfgDefault, cfg, diffsFileName); GNUNET_CONFIGURATION_destroy (cfg); @@ -225,7 +232,7 @@ checkDiffs (struct GNUNET_CONFIGURATION_Handle *cfgDefault, int option) cbData.callBackOption = COMPARE; cbData.cfgDiffs = cfgDiffs; GNUNET_CONFIGURATION_iterate (cfg, diffsCallBack, &cbData); - if ((ret = cbData.status) == 1) + if (1 == (ret = cbData.status)) { fprintf (stderr, "Incorrect Configuration Diffs: Diffs may contain data not actually edited\n"); @@ -249,6 +256,7 @@ housekeeping: #endif GNUNET_CONFIGURATION_destroy (cfg); GNUNET_CONFIGURATION_destroy (cfgDiffs); + GNUNET_free (diffsFileName); return ret; } diff --git a/src/util/test_resolver_api.c b/src/util/test_resolver_api.c index f49d7a79a..7cef33e60 100644 --- a/src/util/test_resolver_api.c +++ b/src/util/test_resolver_api.c @@ -159,6 +159,7 @@ check () { int ok = 1 + 2 + 4 + 8; char *fn; + char *pfx; pid_t pid; char *const argv[] = { "test-resolver-api", "-c", @@ -171,9 +172,11 @@ check () struct GNUNET_GETOPT_CommandLineOption options[] = { GNUNET_GETOPT_OPTION_END }; + pfx = GNUNET_OS_installation_get_path(GNUNET_OS_IPK_BINDIR); GNUNET_asprintf(&fn, "%s%cgnunet-service-resolver", - GNUNET_OS_installation_get_path(GNUNET_OS_IPK_BINDIR), + pfx, DIR_SEPARATOR); + GNUNET_free (pfx); pid = GNUNET_OS_start_process (fn, "gnunet-service-resolver", #if VERBOSE -- 2.25.1