summaryrefslogtreecommitdiff
path: root/src/exchange
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-09-23 16:52:13 +0200
committerChristian Grothoff <christian@grothoff.org>2016-09-23 16:52:13 +0200
commit265fc74b656910dda559f410aa140c57de261cc9 (patch)
tree03118e51436ec50e6322cb7742908f6569ed0c01 /src/exchange
parentf43bac58947fd208bfb0cc5d6c6c1e4ba34d10ff (diff)
downloadexchange-265fc74b656910dda559f410aa140c57de261cc9.tar.gz
exchange-265fc74b656910dda559f410aa140c57de261cc9.tar.bz2
exchange-265fc74b656910dda559f410aa140c57de261cc9.zip
check return values, fix use of uninit memory on certain error handling paths
Diffstat (limited to 'src/exchange')
-rw-r--r--src/exchange/taler-exchange-httpd.c3
-rw-r--r--src/exchange/taler-exchange-httpd_refresh.c15
2 files changed, 11 insertions, 7 deletions
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<num_newcoins;j++)
- if (NULL != denom_pubs[j].rsa_public_key)
- GNUNET_CRYPTO_rsa_public_key_free (denom_pubs[j].rsa_public_key);
- GNUNET_free (denom_pubs);
+ if (NULL != denom_pubs)
+ {
+ for (j=0;j<num_newcoins;j++)
+ if (NULL != denom_pubs[j].rsa_public_key)
+ GNUNET_CRYPTO_rsa_public_key_free (denom_pubs[j].rsa_public_key);
+ GNUNET_free (denom_pubs);
+ }
+ cleanup_hc:
if (NULL != hash_context)
GNUNET_CRYPTO_hash_context_abort (hash_context);
return res;