From 265fc74b656910dda559f410aa140c57de261cc9 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 23 Sep 2016 16:52:13 +0200 Subject: check return values, fix use of uninit memory on certain error handling paths --- src/exchange/taler-exchange-httpd.c | 3 ++- src/exchange/taler-exchange-httpd_refresh.c | 15 +++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'src/exchange') diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c index 75a765720..230c31a64 100644 --- a/src/exchange/taler-exchange-httpd.c +++ b/src/exchange/taler-exchange-httpd.c @@ -1042,7 +1042,8 @@ main (int argc, unixpath_admin_mode); if (-1 == fh_admin) { - GNUNET_break (0 == close (fh)); + if (-1 != fh) + GNUNET_break (0 == close (fh)); return 1; } } diff --git a/src/exchange/taler-exchange-httpd_refresh.c b/src/exchange/taler-exchange-httpd_refresh.c index 655749eb0..2a14a55b2 100644 --- a/src/exchange/taler-exchange-httpd_refresh.c +++ b/src/exchange/taler-exchange-httpd_refresh.c @@ -342,7 +342,6 @@ handle_refresh_melt_json (struct MHD_Connection *connection, struct TALER_EXCHANGEDB_RefreshCommitCoin *commit_coin[TALER_CNC_KAPPA]; struct TALER_TransferPublicKeyP transfer_pub[TALER_CNC_KAPPA]; - /* For the signature check, we hash most of the inputs together (except for the signatures on the coins). */ hash_context = GNUNET_CRYPTO_hash_context_start (); @@ -362,7 +361,7 @@ handle_refresh_melt_json (struct MHD_Connection *connection, { GNUNET_break_op (0); res = (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES; - goto cleanup; + goto cleanup_hc; } GNUNET_CRYPTO_hash_context_read (hash_context, &transfer_pub[i], @@ -491,10 +490,14 @@ handle_refresh_melt_json (struct MHD_Connection *connection, if (NULL != coin_melt_details.coin_info.denom_sig.rsa_signature) GNUNET_CRYPTO_rsa_signature_free (coin_melt_details.coin_info.denom_sig.rsa_signature); cleanup_denoms: - for (j=0;j