From 4f82885560d5d468ef5230f7ec383c612cc9625c Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 7 May 2020 20:22:02 +0200 Subject: towards changing timestamp in deposit confirmation (tests failing) --- src/exchangedb/plugin_exchangedb_postgres.c | 62 ++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 10 deletions(-) (limited to 'src/exchangedb/plugin_exchangedb_postgres.c') diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index 5bd674b2d..93577feb4 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -796,7 +796,7 @@ postgres_get_session (void *cls) "(coin_pub" ",amount_with_fee_val" ",amount_with_fee_frac" - ",timestamp" + ",wallet_timestamp" ",refund_deadline" ",wire_deadline" ",merchant_pub" @@ -804,22 +804,28 @@ postgres_get_session (void *cls) ",h_wire" ",coin_sig" ",wire" + ",exchange_timestamp" ") VALUES " "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10," - " $11);", - 11), + " $11, $12);", + 12), /* Fetch an existing deposit request, used to ensure idempotency during /deposit processing. Used in #postgres_have_deposit(). */ GNUNET_PQ_make_prepare ("get_deposit", "SELECT" " amount_with_fee_val" ",amount_with_fee_frac" - ",timestamp" + ",denominations.fee_deposit_val" + ",denominations.fee_deposit_frac" + ",wallet_timestamp" + ",exchange_timestamp" ",refund_deadline" ",wire_deadline" ",h_contract_terms" ",h_wire" " FROM deposits" + " JOIN known_coins USING (coin_pub)" + " JOIN denominations USING (denom_pub_hash)" " WHERE ((coin_pub=$1)" " AND (merchant_pub=$3)" " AND (h_contract_terms=$2))" @@ -830,7 +836,8 @@ postgres_get_session (void *cls) "SELECT" " amount_with_fee_val" ",amount_with_fee_frac" - ",timestamp" + ",wallet_timestamp" + ",exchange_timestamp" ",merchant_pub" ",denom.denom_pub" ",coin_pub" @@ -881,6 +888,8 @@ postgres_get_session (void *cls) ",wire" ",merchant_pub" ",coin_pub" + ",exchange_timestamp" + ",wallet_timestamp" " FROM deposits" " JOIN known_coins USING (coin_pub)" " JOIN denominations denom USING (denom_pub_hash)" @@ -900,6 +909,8 @@ postgres_get_session (void *cls) ",denom.fee_deposit_val" ",denom.fee_deposit_frac" ",wire_deadline" + ",exchange_timestamp" + ",wallet_timestamp" ",h_contract_terms" ",coin_pub" " FROM deposits" @@ -945,7 +956,7 @@ postgres_get_session (void *cls) ",amount_with_fee_frac" ",denom.fee_deposit_val" ",denom.fee_deposit_frac" - ",timestamp" + ",wallet_timestamp" ",refund_deadline" ",wire_deadline" ",merchant_pub" @@ -2571,6 +2582,8 @@ postgres_get_reserve_history (void *cls, * @param session database connection * @param deposit deposit to search for * @param check_extras whether to check extra fields match or not + * @param[out] deposit_fee set to the deposit fee the exchange charged + * @param[out] exchange_timestamp set to the time when the exchange received the deposit * @return 1 if we know this operation, * 0 if this exact deposit is unknown to us, * otherwise transaction error status @@ -2579,7 +2592,9 @@ static enum GNUNET_DB_QueryStatus postgres_have_deposit (void *cls, struct TALER_EXCHANGEDB_Session *session, const struct TALER_EXCHANGEDB_Deposit *deposit, - int check_extras) + int check_extras, + struct TALER_Amount *deposit_fee, + struct GNUNET_TIME_Absolute *exchange_timestamp) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { @@ -2592,12 +2607,16 @@ postgres_have_deposit (void *cls, struct GNUNET_PQ_ResultSpec rs[] = { TALER_PQ_RESULT_SPEC_AMOUNT ("amount_with_fee", &deposit2.amount_with_fee), - TALER_PQ_result_spec_absolute_time ("timestamp", + TALER_PQ_result_spec_absolute_time ("wallet_timestamp", &deposit2.timestamp), + TALER_PQ_result_spec_absolute_time ("exchange_timestamp", + exchange_timestamp), TALER_PQ_result_spec_absolute_time ("refund_deadline", &deposit2.refund_deadline), TALER_PQ_result_spec_absolute_time ("wire_deadline", &deposit2.wire_deadline), + TALER_PQ_RESULT_SPEC_AMOUNT ("fee_deposit", + deposit_fee), GNUNET_PQ_result_spec_auto_from_type ("h_wire", &deposit2.h_wire), GNUNET_PQ_result_spec_end @@ -2776,6 +2795,8 @@ postgres_get_ready_deposit (void *cls, struct TALER_Amount amount_with_fee; struct TALER_Amount deposit_fee; struct GNUNET_TIME_Absolute wire_deadline; + struct GNUNET_TIME_Absolute wallet_timestamp; + struct GNUNET_TIME_Absolute exchange_timestamp; struct GNUNET_HashCode h_contract_terms; struct TALER_MerchantPublicKeyP merchant_pub; struct TALER_CoinSpendPublicKeyP coin_pub; @@ -2788,6 +2809,10 @@ postgres_get_ready_deposit (void *cls, &amount_with_fee), TALER_PQ_RESULT_SPEC_AMOUNT ("fee_deposit", &deposit_fee), + TALER_PQ_result_spec_absolute_time ("exchange_timestamp", + &exchange_timestamp), + TALER_PQ_result_spec_absolute_time ("wallet_timestamp", + &wallet_timestamp), TALER_PQ_result_spec_absolute_time ("wire_deadline", &wire_deadline), GNUNET_PQ_result_spec_auto_from_type ("h_contract_terms", @@ -2817,6 +2842,8 @@ postgres_get_ready_deposit (void *cls, qs = deposit_cb (deposit_cb_cls, serial_id, + exchange_timestamp, + wallet_timestamp, &merchant_pub, &coin_pub, &amount_with_fee, @@ -2898,6 +2925,8 @@ match_deposit_cb (void *cls, { struct TALER_Amount amount_with_fee; struct TALER_Amount deposit_fee; + struct GNUNET_TIME_Absolute exchange_timestamp; + struct GNUNET_TIME_Absolute wallet_timestamp; struct GNUNET_TIME_Absolute wire_deadline; struct GNUNET_HashCode h_contract_terms; struct TALER_CoinSpendPublicKeyP coin_pub; @@ -2912,6 +2941,10 @@ match_deposit_cb (void *cls, &deposit_fee), TALER_PQ_result_spec_absolute_time ("wire_deadline", &wire_deadline), + TALER_PQ_result_spec_absolute_time ("exchange_timestamp", + &exchange_timestamp), + TALER_PQ_result_spec_absolute_time ("wallet_timestamp", + &wallet_timestamp), GNUNET_PQ_result_spec_auto_from_type ("h_contract_terms", &h_contract_terms), GNUNET_PQ_result_spec_auto_from_type ("coin_pub", @@ -2930,6 +2963,8 @@ match_deposit_cb (void *cls, } qs = mdc->deposit_cb (mdc->deposit_cb_cls, serial_id, + exchange_timestamp, + wallet_timestamp, mdc->merchant_pub, &coin_pub, &amount_with_fee, @@ -3210,12 +3245,14 @@ postgres_ensure_coin_known (void *cls, * * @param cls the `struct PostgresClosure` with the plugin-specific state * @param session connection to the database + * @param exchange_timestamp time the exchange received the deposit request * @param deposit deposit information to store * @return query result status */ static enum GNUNET_DB_QueryStatus postgres_insert_deposit (void *cls, struct TALER_EXCHANGEDB_Session *session, + struct GNUNET_TIME_Absolute exchange_timestamp, const struct TALER_EXCHANGEDB_Deposit *deposit) { struct GNUNET_PQ_QueryParam params[] = { @@ -3229,6 +3266,7 @@ postgres_insert_deposit (void *cls, GNUNET_PQ_query_param_auto_from_type (&deposit->h_wire), GNUNET_PQ_query_param_auto_from_type (&deposit->csig), TALER_PQ_query_param_json (deposit->receiver_wire_account), + TALER_PQ_query_param_absolute_time (&exchange_timestamp), GNUNET_PQ_query_param_end }; @@ -4042,7 +4080,7 @@ add_coin_deposit (void *cls, &deposit->amount_with_fee), TALER_PQ_RESULT_SPEC_AMOUNT ("fee_deposit", &deposit->deposit_fee), - TALER_PQ_result_spec_absolute_time ("timestamp", + TALER_PQ_result_spec_absolute_time ("wallet_timestamp", &deposit->timestamp), TALER_PQ_result_spec_absolute_time ("refund_deadline", &deposit->refund_deadline), @@ -5462,14 +5500,17 @@ deposit_serial_helper_cb (void *cls, for (unsigned int i = 0; icb (dsc->cb_cls, rowid, + exchange_timestamp, deposit.timestamp, &deposit.merchant_pub, &denom_pub, -- cgit v1.2.3 From 6eb32a65bf67438159fb1b6e3cf404b8721784ee Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 5 Jul 2020 16:32:15 +0200 Subject: fix error reporting/handling --- src/exchange-tools/taler-exchange-keyup.c | 12 ++++++------ src/exchange/taler-exchange-httpd.c | 14 ++++++++++---- src/exchange/taler-exchange-httpd_wire.c | 4 ++++ src/exchangedb/plugin_exchangedb_postgres.c | 12 +++++++++++- 4 files changed, 31 insertions(+), 11 deletions(-) (limited to 'src/exchangedb/plugin_exchangedb_postgres.c') diff --git a/src/exchange-tools/taler-exchange-keyup.c b/src/exchange-tools/taler-exchange-keyup.c index a3e3bce29..0ea661d49 100644 --- a/src/exchange-tools/taler-exchange-keyup.c +++ b/src/exchange-tools/taler-exchange-keyup.c @@ -1016,9 +1016,9 @@ create_wire_fee_for_method (void *cls, af->wire_fee.currency)) ) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Invalid or missing amount in `%s' under `%s'\n", - section, - opt); + "Invalid or missing amount for option `%s' in section `%s'\n", + opt, + section); *ret = GNUNET_SYSERR; GNUNET_free (opt); break; @@ -1038,9 +1038,9 @@ create_wire_fee_for_method (void *cls, af->closing_fee.currency)) ) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Invalid or missing amount in `%s' under `%s'\n", - section, - opt); + "Invalid or missing amount for option `%s' in section `%s'\n", + opt, + section); *ret = GNUNET_SYSERR; GNUNET_free (opt); break; diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c index 00932c0f0..df01b01be 100644 --- a/src/exchange/taler-exchange-httpd.c +++ b/src/exchange/taler-exchange-httpd.c @@ -827,8 +827,8 @@ exchange_serve_process_config (void) &TEH_master_public_key. eddsa_pub)) { - fprintf (stderr, - "Invalid master public key given in exchange configuration."); + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Invalid master public key given in exchange configuration."); GNUNET_free (master_public_key_str); return GNUNET_SYSERR; } @@ -840,14 +840,18 @@ exchange_serve_process_config (void) if (GNUNET_OK != TEH_WIRE_init (TEH_cfg)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Failed to setup wire subsystem\n"); return GNUNET_SYSERR; + } if (NULL == (TEH_plugin = TALER_EXCHANGEDB_plugin_load (TEH_cfg))) { - fprintf (stderr, - "Failed to initialize DB subsystem\n"); + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Failed to initialize DB subsystem\n"); TEH_WIRE_done (); return GNUNET_SYSERR; } @@ -859,6 +863,8 @@ exchange_serve_process_config (void) &serve_unixpath, &unixpath_mode)) { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Failed to setup HTTPd subsystem\n"); TEH_WIRE_done (); return GNUNET_SYSERR; } diff --git a/src/exchange/taler-exchange-httpd_wire.c b/src/exchange/taler-exchange-httpd_wire.c index 38bbad4ad..471fa4fad 100644 --- a/src/exchange/taler-exchange-httpd_wire.c +++ b/src/exchange/taler-exchange-httpd_wire.c @@ -341,6 +341,8 @@ TEH_WIRE_init (const struct GNUNET_CONFIGURATION_Handle *cfg) &ret); if (GNUNET_OK != ret) { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Error setting up bank accounts\n"); TEH_WIRE_done (); return GNUNET_SYSERR; } @@ -349,6 +351,8 @@ TEH_WIRE_init (const struct GNUNET_CONFIGURATION_Handle *cfg) (0 == json_object_size (wire_fee_object)) ) { TEH_WIRE_done (); + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "No bank accounts configured\n"); return GNUNET_SYSERR; } wire_methods = json_pack ("{s:O, s:O, s:o}", diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index 93577feb4..641cbbef1 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -1812,8 +1812,12 @@ postgres_iterate_denomination_info (void *cls, .cb_cls = cb_cls, .pg = pc }; + struct TALER_EXCHANGEDB_Session *session; - return GNUNET_PQ_eval_prepared_multi_select (postgres_get_session (pc)->conn, + session = postgres_get_session (pc); + if (NULL == session) + return GNUNET_DB_STATUS_HARD_ERROR; + return GNUNET_PQ_eval_prepared_multi_select (session->conn, "denomination_iterate", params, &domination_cb_helper, @@ -3068,6 +3072,8 @@ postgres_get_known_coin (void *cls, coin_info->coin_pub = *coin_pub; if (NULL == session) session = postgres_get_session (pc); + if (NULL == session) + return GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_PQ_eval_prepared_singleton_select (session->conn, "get_known_coin", params, @@ -3107,6 +3113,8 @@ postgres_get_coin_denomination ( TALER_B2S (coin_pub)); if (NULL == session) session = postgres_get_session (pc); + if (NULL == session) + return GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_PQ_eval_prepared_singleton_select (session->conn, "get_coin_denomination", params, @@ -3475,6 +3483,8 @@ postgres_get_melt (void *cls, melt->session.coin.denom_sig.rsa_signature = NULL; if (NULL == session) session = postgres_get_session (pg); + if (NULL == session) + return GNUNET_DB_STATUS_HARD_ERROR; qs = GNUNET_PQ_eval_prepared_singleton_select (session->conn, "get_melt", params, -- cgit v1.2.3 From ed5b98a2c2308fbd44b906a30286d2689fd304dd Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 5 Jul 2020 16:58:43 +0200 Subject: GNUNET_free_non_null is gone, use GNUNET_free --- src/auditor/taler-auditor-exchange.c | 4 ++-- src/auditor/taler-auditor-httpd.c | 4 ++-- src/auditor/taler-auditor-sign.c | 4 ++-- src/auditor/taler-helper-auditor-coins.c | 4 ++-- src/auditor/taler-helper-auditor-reserves.c | 2 +- src/bank-lib/fakebank.c | 2 +- src/benchmark/taler-exchange-benchmark.c | 4 ++-- src/curl/curl.c | 2 +- src/exchange/taler-exchange-httpd.c | 8 ++++---- src/exchange/taler-exchange-httpd_refreshes_reveal.c | 4 ++-- src/exchange/taler-exchange-httpd_transfers_get.c | 2 +- src/exchangedb/exchangedb_accounts.c | 2 +- src/exchangedb/plugin_exchangedb_common.c | 6 +++--- src/exchangedb/plugin_exchangedb_postgres.c | 4 ++-- src/exchangedb/test_exchangedb.c | 4 ++-- src/exchangedb/test_exchangedb_auditors.c | 2 +- src/exchangedb/test_exchangedb_denomkeys.c | 6 +++--- src/lib/auditor_api_handle.c | 2 +- src/lib/exchange_api_common.c | 4 ++-- src/lib/exchange_api_handle.c | 2 +- src/lib/exchange_api_refresh_common.c | 6 +++--- src/testing/testing_api_cmd_bank_history_credit.c | 2 +- src/testing/testing_api_cmd_bank_history_debit.c | 2 +- src/testing/testing_api_cmd_batch.c | 2 +- src/testing/testing_api_cmd_exec_auditor-sign.c | 2 +- src/testing/testing_api_cmd_refresh.c | 8 ++++---- src/testing/testing_api_cmd_revoke.c | 2 +- src/testing/testing_api_cmd_serialize_keys.c | 2 +- src/testing/testing_api_cmd_withdraw.c | 2 +- src/testing/testing_api_loop.c | 4 ++-- 30 files changed, 52 insertions(+), 52 deletions(-) (limited to 'src/exchangedb/plugin_exchangedb_postgres.c') diff --git a/src/auditor/taler-auditor-exchange.c b/src/auditor/taler-auditor-exchange.c index 41df335b3..2091031cb 100644 --- a/src/auditor/taler-auditor-exchange.c +++ b/src/auditor/taler-auditor-exchange.c @@ -111,10 +111,10 @@ main (int argc, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Malformed configuration file `%s', exit ...\n", cfgfile); - GNUNET_free_non_null (cfgfile); + GNUNET_free (cfgfile); return 1; } - GNUNET_free_non_null (cfgfile); + GNUNET_free (cfgfile); if (! remove_flag) { diff --git a/src/auditor/taler-auditor-httpd.c b/src/auditor/taler-auditor-httpd.c index d326f0f62..d1e3c2de5 100644 --- a/src/auditor/taler-auditor-httpd.c +++ b/src/auditor/taler-auditor-httpd.c @@ -579,10 +579,10 @@ main (int argc, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Malformed configuration file `%s', exiting ...\n", cfgfile); - GNUNET_free_non_null (cfgfile); + GNUNET_free (cfgfile); return 1; } - GNUNET_free_non_null (cfgfile); + GNUNET_free (cfgfile); if (GNUNET_OK != auditor_serve_process_config ()) diff --git a/src/auditor/taler-auditor-sign.c b/src/auditor/taler-auditor-sign.c index 7dd7605fb..af6cec2c4 100644 --- a/src/auditor/taler-auditor-sign.c +++ b/src/auditor/taler-auditor-sign.c @@ -213,10 +213,10 @@ main (int argc, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Malformed configuration file `%s', exiting ...\n", cfgfile); - GNUNET_free_non_null (cfgfile); + GNUNET_free (cfgfile); return 1; } - GNUNET_free_non_null (cfgfile); + GNUNET_free (cfgfile); if ( (NULL == auditor_key_file) && (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, diff --git a/src/auditor/taler-helper-auditor-coins.c b/src/auditor/taler-helper-auditor-coins.c index 158baa8b3..1a03ac72d 100644 --- a/src/auditor/taler-helper-auditor-coins.c +++ b/src/auditor/taler-helper-auditor-coins.c @@ -1351,7 +1351,7 @@ refresh_session_cb (void *cls, if (GNUNET_OK != reveal_ctx.err) { - GNUNET_free_non_null (reveal_ctx.new_issues); + GNUNET_free (reveal_ctx.new_issues); return (GNUNET_SYSERR == reveal_ctx.err) ? GNUNET_SYSERR : GNUNET_OK; } @@ -1458,7 +1458,7 @@ refresh_session_cb (void *cls, &value); } } - GNUNET_free_non_null (reveal_ctx.new_issues); + GNUNET_free (reveal_ctx.new_issues); } /* update old coin's denomination balance */ diff --git a/src/auditor/taler-helper-auditor-reserves.c b/src/auditor/taler-helper-auditor-reserves.c index 3460515a2..0b140e740 100644 --- a/src/auditor/taler-helper-auditor-reserves.c +++ b/src/auditor/taler-helper-auditor-reserves.c @@ -1269,7 +1269,7 @@ verify_reserve_balance (void *cls, GNUNET_CONTAINER_multihashmap_remove (rc->reserves, key, rs)); - GNUNET_free_non_null (rs->sender_account); + GNUNET_free (rs->sender_account); GNUNET_free (rs); return ret; } diff --git a/src/bank-lib/fakebank.c b/src/bank-lib/fakebank.c index 6df6cdfad..699acb51b 100644 --- a/src/bank-lib/fakebank.c +++ b/src/bank-lib/fakebank.c @@ -1314,7 +1314,7 @@ handle_mhd_request (void *cls, upload_data, upload_data_size, con_cls); - GNUNET_free_non_null (account); + GNUNET_free (account); return ret; } diff --git a/src/benchmark/taler-exchange-benchmark.c b/src/benchmark/taler-exchange-benchmark.c index 57fde4306..7054e01e2 100644 --- a/src/benchmark/taler-exchange-benchmark.c +++ b/src/benchmark/taler-exchange-benchmark.c @@ -993,7 +993,7 @@ main (int argc, argc, argv))) { - GNUNET_free_non_null (cfg_filename); + GNUNET_free (cfg_filename); return BAD_CLI_ARG; } GNUNET_log_setup ("taler-exchange-benchmark", @@ -1010,7 +1010,7 @@ main (int argc, else { TALER_LOG_ERROR ("Unknown mode given: '%s'\n", mode_str); - GNUNET_free_non_null (cfg_filename); + GNUNET_free (cfg_filename); return BAD_CONFIG_FILE; } if (NULL == cfg_filename) diff --git a/src/curl/curl.c b/src/curl/curl.c index dd1194906..9e9de6810 100644 --- a/src/curl/curl.c +++ b/src/curl/curl.c @@ -111,6 +111,6 @@ TALER_curl_easy_post_finished (struct TALER_CURL_PostContext *ctx) { curl_slist_free_all (ctx->headers); ctx->headers = NULL; - GNUNET_free_non_null (ctx->json_enc); + GNUNET_free (ctx->json_enc); ctx->json_enc = NULL; } diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c index df01b01be..c614b711e 100644 --- a/src/exchange/taler-exchange-httpd.c +++ b/src/exchange/taler-exchange-httpd.c @@ -1300,8 +1300,8 @@ main (int argc, GNUNET_log_setup ("taler-exchange-httpd", (NULL == loglev) ? "INFO" : loglev, logfile)); - GNUNET_free_non_null (loglev); - GNUNET_free_non_null (logfile); + GNUNET_free (loglev); + GNUNET_free (logfile); if (NULL == cfgfile) cfgfile = GNUNET_strdup (GNUNET_OS_project_data_get ()->user_config_file); TEH_cfg = GNUNET_CONFIGURATION_create (); @@ -1312,10 +1312,10 @@ main (int argc, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Malformed configuration file `%s', exit ...\n", cfgfile); - GNUNET_free_non_null (cfgfile); + GNUNET_free (cfgfile); return 1; } - GNUNET_free_non_null (cfgfile); + GNUNET_free (cfgfile); if (GNUNET_OK != exchange_serve_process_config ()) return 1; diff --git a/src/exchange/taler-exchange-httpd_refreshes_reveal.c b/src/exchange/taler-exchange-httpd_refreshes_reveal.c index a9c998af0..e752ce969 100644 --- a/src/exchange/taler-exchange-httpd_refreshes_reveal.c +++ b/src/exchange/taler-exchange-httpd_refreshes_reveal.c @@ -608,7 +608,7 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state, if (GNUNET_OK != res) { for (unsigned int j = 0; jdk = &dkis[i]->denom_pub; @@ -792,7 +792,7 @@ cleanup: rctx->ev_sigs = NULL; /* just to be safe... */ } for (unsigned int i = 0; iwire_method); + GNUNET_free (ctx->wire_method); ctx->wire_method = NULL; } diff --git a/src/exchangedb/exchangedb_accounts.c b/src/exchangedb/exchangedb_accounts.c index b66b1bcc1..986d4ae2d 100644 --- a/src/exchangedb/exchangedb_accounts.c +++ b/src/exchangedb/exchangedb_accounts.c @@ -125,7 +125,7 @@ check_for_account (void *cls, } GNUNET_free (payto_uri); GNUNET_free (method); - GNUNET_free_non_null (wire_response_filename); + GNUNET_free (wire_response_filename); } diff --git a/src/exchangedb/plugin_exchangedb_common.c b/src/exchangedb/plugin_exchangedb_common.c index ce425f824..6db0c0e02 100644 --- a/src/exchangedb/plugin_exchangedb_common.c +++ b/src/exchangedb/plugin_exchangedb_common.c @@ -40,8 +40,8 @@ common_free_reserve_history (void *cls, struct TALER_EXCHANGEDB_BankTransfer *bt; bt = rh->details.bank; - GNUNET_free_non_null (bt->sender_account_details); - GNUNET_free_non_null (bt->wire_reference); + GNUNET_free (bt->sender_account_details); + GNUNET_free (bt->wire_reference); GNUNET_free (bt); break; } @@ -68,7 +68,7 @@ common_free_reserve_history (void *cls, struct TALER_EXCHANGEDB_ClosingTransfer *closing; closing = rh->details.closing; - GNUNET_free_non_null (closing->receiver_account_details); + GNUNET_free (closing->receiver_account_details); GNUNET_free (closing); break; } diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index 641cbbef1..dede901f9 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -3830,9 +3830,9 @@ cleanup: GNUNET_CRYPTO_rsa_public_key_free (rrc->denom_pub.rsa_public_key); if (NULL != rrc->coin_sig.rsa_signature) GNUNET_CRYPTO_rsa_signature_free (rrc->coin_sig.rsa_signature); - GNUNET_free_non_null (rrc->coin_ev); + GNUNET_free (rrc->coin_ev); } - GNUNET_free_non_null (grctx.rrcs); + GNUNET_free (grctx.rrcs); return qs; } diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c index fe3ed7854..043095e7b 100644 --- a/src/exchangedb/test_exchangedb.c +++ b/src/exchangedb/test_exchangedb.c @@ -706,12 +706,12 @@ drop: destroy_denom_key_pair (dkp); GNUNET_CRYPTO_rsa_signature_free ( refresh_session.coin.denom_sig.rsa_signature); - GNUNET_free_non_null (new_denom_pubs); + GNUNET_free (new_denom_pubs); for (unsigned int cnt = 0; (NULL != new_dkp) && (cnt < MELT_NEW_COINS) && (NULL != new_dkp[cnt]); cnt++) destroy_denom_key_pair (new_dkp[cnt]); - GNUNET_free_non_null (new_dkp); + GNUNET_free (new_dkp); return ret; } diff --git a/src/exchangedb/test_exchangedb_auditors.c b/src/exchangedb/test_exchangedb_auditors.c index efd3ffe14..2af1776aa 100644 --- a/src/exchangedb/test_exchangedb_auditors.c +++ b/src/exchangedb/test_exchangedb_auditors.c @@ -164,6 +164,6 @@ EXITIF_exit: } if (NULL != cfg) GNUNET_CONFIGURATION_destroy (cfg); - GNUNET_free_non_null (tmpfile); + GNUNET_free (tmpfile); return ret; } diff --git a/src/exchangedb/test_exchangedb_denomkeys.c b/src/exchangedb/test_exchangedb_denomkeys.c index 1acb61dde..b28b2999b 100644 --- a/src/exchangedb/test_exchangedb_denomkeys.c +++ b/src/exchangedb/test_exchangedb_denomkeys.c @@ -194,14 +194,14 @@ main (int argc, ret = 0; EXITIF_exit: - GNUNET_free_non_null (enc); - GNUNET_free_non_null (tmpfile); + GNUNET_free (enc); + GNUNET_free (tmpfile); if (NULL != tmpdir) { (void) GNUNET_DISK_directory_remove (tmpdir); GNUNET_free (tmpdir); } - GNUNET_free_non_null (enc_read); + GNUNET_free (enc_read); if (NULL != dki.denom_priv.rsa_private_key) GNUNET_CRYPTO_rsa_private_key_free (dki.denom_priv.rsa_private_key); if (NULL != dki.denom_pub.rsa_public_key) diff --git a/src/lib/auditor_api_handle.c b/src/lib/auditor_api_handle.c index ccb7cc1eb..731dcf0c3 100644 --- a/src/lib/auditor_api_handle.c +++ b/src/lib/auditor_api_handle.c @@ -525,7 +525,7 @@ TALER_AUDITOR_disconnect (struct TALER_AUDITOR_Handle *auditor) free_version_request (auditor->vr); auditor->vr = NULL; } - GNUNET_free_non_null (auditor->version); + GNUNET_free (auditor->version); if (NULL != auditor->retry_task) { GNUNET_SCHEDULER_cancel (auditor->retry_task); diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c index bf8eb5376..e7e87487b 100644 --- a/src/lib/exchange_api_common.c +++ b/src/lib/exchange_api_common.c @@ -425,8 +425,8 @@ TALER_EXCHANGE_free_reserve_history ( switch (rhistory[i].type) { case TALER_EXCHANGE_RTT_CREDIT: - GNUNET_free_non_null (rhistory[i].details.in_details.wire_reference); - GNUNET_free_non_null (rhistory[i].details.in_details.sender_url); + GNUNET_free (rhistory[i].details.in_details.wire_reference); + GNUNET_free (rhistory[i].details.in_details.sender_url); break; case TALER_EXCHANGE_RTT_WITHDRAWAL: break; diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c index c9c1b09bd..283f77043 100644 --- a/src/lib/exchange_api_handle.c +++ b/src/lib/exchange_api_handle.c @@ -1135,7 +1135,7 @@ free_key_data (struct TALER_EXCHANGE_Keys *key_data) GNUNET_array_grow (key_data->auditors, key_data->auditors_size, 0); - GNUNET_free_non_null (key_data->version); + GNUNET_free (key_data->version); key_data->version = NULL; } diff --git a/src/lib/exchange_api_refresh_common.c b/src/lib/exchange_api_refresh_common.c index 9e9f6e0c0..8ac0bdfc9 100644 --- a/src/lib/exchange_api_refresh_common.c +++ b/src/lib/exchange_api_refresh_common.c @@ -61,7 +61,7 @@ TALER_EXCHANGE_free_melt_data_ (struct MeltData *md) } for (unsigned int i = 0; ifresh_coins[i]); + GNUNET_free (md->fresh_coins[i]); /* Finally, clean up a bit... */ GNUNET_CRYPTO_zero_keys (md, sizeof (struct MeltData)); @@ -613,8 +613,8 @@ TALER_EXCHANGE_refresh_prepare ( for (unsigned int i = 0; i < TALER_CNC_KAPPA; i++) { for (unsigned int j = 0; j < fresh_pks_len; j++) - GNUNET_free_non_null (rce[i].new_coins[j].coin_ev); - GNUNET_free_non_null (rce[i].new_coins); + GNUNET_free (rce[i].new_coins[j].coin_ev); + GNUNET_free (rce[i].new_coins); } TALER_EXCHANGE_free_melt_data_ (&md); return buf; diff --git a/src/testing/testing_api_cmd_bank_history_credit.c b/src/testing/testing_api_cmd_bank_history_credit.c index 0b71c7162..069f62cb0 100644 --- a/src/testing/testing_api_cmd_bank_history_credit.c +++ b/src/testing/testing_api_cmd_bank_history_credit.c @@ -549,7 +549,7 @@ history_cleanup (void *cls, GNUNET_free (hs->account_url); for (unsigned int off = 0; offtotal; off++) GNUNET_free (hs->h[off].url); - GNUNET_free_non_null (hs->h); + GNUNET_free (hs->h); GNUNET_free (hs); } diff --git a/src/testing/testing_api_cmd_bank_history_debit.c b/src/testing/testing_api_cmd_bank_history_debit.c index ebabf8d94..fcc78bfb7 100644 --- a/src/testing/testing_api_cmd_bank_history_debit.c +++ b/src/testing/testing_api_cmd_bank_history_debit.c @@ -552,7 +552,7 @@ history_cleanup (void *cls, GNUNET_free (hs->h[off].c_url); GNUNET_free (hs->h[off].d_url); } - GNUNET_free_non_null (hs->h); + GNUNET_free (hs->h); GNUNET_free (hs); } diff --git a/src/testing/testing_api_cmd_batch.c b/src/testing/testing_api_cmd_batch.c index d81a5c38d..ca23d7fd9 100644 --- a/src/testing/testing_api_cmd_batch.c +++ b/src/testing/testing_api_cmd_batch.c @@ -99,7 +99,7 @@ batch_cleanup (void *cls, i++) bs->batch[i].cleanup (bs->batch[i].cls, &bs->batch[i]); - GNUNET_free_non_null (bs->batch); + GNUNET_free (bs->batch); GNUNET_free (bs); } diff --git a/src/testing/testing_api_cmd_exec_auditor-sign.c b/src/testing/testing_api_cmd_exec_auditor-sign.c index 4c88ccca0..82d7e6669 100644 --- a/src/testing/testing_api_cmd_exec_auditor-sign.c +++ b/src/testing/testing_api_cmd_exec_auditor-sign.c @@ -166,7 +166,7 @@ auditor_sign_cleanup (void *cls, GNUNET_OS_process_destroy (ass->auditor_sign_proc); ass->auditor_sign_proc = NULL; } - GNUNET_free_non_null (ass->signed_keys_out); + GNUNET_free (ass->signed_keys_out); GNUNET_free (ass); } diff --git a/src/testing/testing_api_cmd_refresh.c b/src/testing/testing_api_cmd_refresh.c index 92229cc72..9a13c1354 100644 --- a/src/testing/testing_api_cmd_refresh.c +++ b/src/testing/testing_api_cmd_refresh.c @@ -514,7 +514,7 @@ refresh_reveal_cleanup (void *cls, for (unsigned int j = 0; j < rrs->num_fresh_coins; j++) GNUNET_CRYPTO_rsa_signature_free (rrs->fresh_coins[j].sig.rsa_signature); - GNUNET_free_non_null (rrs->fresh_coins); + GNUNET_free (rrs->fresh_coins); rrs->fresh_coins = NULL; rrs->num_fresh_coins = 0; GNUNET_free (rrs); @@ -1128,12 +1128,12 @@ melt_cleanup (void *cls, for (unsigned int i = 0; i < rms->num_fresh_coins; i++) GNUNET_CRYPTO_rsa_public_key_free (rms->fresh_pks[i].key.rsa_public_key); } - GNUNET_free_non_null (rms->fresh_pks); + GNUNET_free (rms->fresh_pks); rms->fresh_pks = NULL; - GNUNET_free_non_null (rms->refresh_data); + GNUNET_free (rms->refresh_data); rms->refresh_data = NULL; rms->refresh_data_length = 0; - GNUNET_free_non_null (rms->melt_fresh_amounts); + GNUNET_free (rms->melt_fresh_amounts); GNUNET_free (rms); } diff --git a/src/testing/testing_api_cmd_revoke.c b/src/testing/testing_api_cmd_revoke.c index 1006fbc34..d9320865a 100644 --- a/src/testing/testing_api_cmd_revoke.c +++ b/src/testing/testing_api_cmd_revoke.c @@ -85,7 +85,7 @@ revoke_cleanup (void *cls, GNUNET_OS_process_destroy (rs->revoke_proc); rs->revoke_proc = NULL; } - GNUNET_free_non_null (rs->dhks); + GNUNET_free (rs->dhks); GNUNET_free (rs); } diff --git a/src/testing/testing_api_cmd_serialize_keys.c b/src/testing/testing_api_cmd_serialize_keys.c index 8a723c5ba..aa39b8a37 100644 --- a/src/testing/testing_api_cmd_serialize_keys.c +++ b/src/testing/testing_api_cmd_serialize_keys.c @@ -117,7 +117,7 @@ serialize_keys_cleanup (void *cls, { json_decref (sks->keys); } - GNUNET_free_non_null (sks->exchange_url); + GNUNET_free (sks->exchange_url); GNUNET_free (sks); } diff --git a/src/testing/testing_api_cmd_withdraw.c b/src/testing/testing_api_cmd_withdraw.c index d863e406a..5db97cbff 100644 --- a/src/testing/testing_api_cmd_withdraw.c +++ b/src/testing/testing_api_cmd_withdraw.c @@ -387,7 +387,7 @@ withdraw_cleanup (void *cls, TALER_EXCHANGE_destroy_denomination_key (ws->pk); ws->pk = NULL; } - GNUNET_free_non_null (ws->exchange_url); + GNUNET_free (ws->exchange_url); GNUNET_free (ws); } diff --git a/src/testing/testing_api_loop.c b/src/testing/testing_api_loop.c index af4a63c6a..fceff4234 100644 --- a/src/testing/testing_api_loop.c +++ b/src/testing/testing_api_loop.c @@ -355,7 +355,7 @@ do_shutdown (void *cls) TALER_FAKEBANK_stop (is->fakebank); is->fakebank = NULL; } - GNUNET_free_non_null (is->commands); + GNUNET_free (is->commands); } @@ -813,7 +813,7 @@ TALER_TESTING_setup (TALER_TESTING_Main main_cb, &main_ctx); if (NULL != is.final_cleanup_cb) is.final_cleanup_cb (is.final_cleanup_cb_cls); - GNUNET_free_non_null (main_ctx.exchange_url); + GNUNET_free (main_ctx.exchange_url); GNUNET_SIGNAL_handler_uninstall (shc_chld); GNUNET_DISK_pipe_close (sigpipe); sigpipe = NULL; -- cgit v1.2.3