From ae4b240ec29803be6bd56caecf8df413d7bf3851 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 13 Mar 2019 04:11:35 +0100 Subject: [PATCH] return proper error message instead of aborting, fix a few minor memory leaks in taler-exchange-benchmark --- src/benchmark/benchmark.conf | 3 ++ src/benchmark/taler-exchange-benchmark.c | 38 +++++++++++++++++++----- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/benchmark/benchmark.conf b/src/benchmark/benchmark.conf index a160cc1cd..8d3e060d9 100644 --- a/src/benchmark/benchmark.conf +++ b/src/benchmark/benchmark.conf @@ -29,6 +29,9 @@ base_url = "http://localhost:8081/" # Keep it short so the test runs fast. lookahead_sign = 12 h +[auditor] +BASE_URL = "http://localhost:8085/" + [exchangedb-postgres] config = "postgres:///talercheck" diff --git a/src/benchmark/taler-exchange-benchmark.c b/src/benchmark/taler-exchange-benchmark.c index 27020a71f..d1ea272ea 100644 --- a/src/benchmark/taler-exchange-benchmark.c +++ b/src/benchmark/taler-exchange-benchmark.c @@ -908,20 +908,42 @@ main (int argc, GNUNET_CONFIGURATION_iterate_sections (cfg, - pick_exchange_account_cb, + &pick_exchange_account_cb, &bank_details_section); - GNUNET_assert (NULL != bank_details_section); - GNUNET_assert - (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string + if (NULL == bank_details_section) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + _("Missing specification of bank account in configuration\n")); + return BAD_CONFIG_FILE; + } + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_string (cfg, bank_details_section, "url", - &exchange_payto_url)); + &exchange_payto_url)) + { + GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, + bank_details_section, + "url"); + GNUNET_free (bank_details_section); + return BAD_CONFIG_FILE; + } - GNUNET_assert - (TALER_EC_NONE == parse_payto (exchange_payto_url, - &exchange_bank_account)); + if (TALER_EC_NONE != + parse_payto (exchange_payto_url, + &exchange_bank_account)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + _("Malformed payto:// URL `%s' in configuration\n"), + exchange_payto_url); + GNUNET_free (exchange_payto_url); + GNUNET_free (bank_details_section); + return BAD_CONFIG_FILE; + } + GNUNET_free (exchange_payto_url); + GNUNET_free (bank_details_section); } if ( (MODE_EXCHANGE == mode) || (MODE_BOTH == mode) ) {