From 3c8c127e0e629f4075287ad33e54d5c51b24eddb Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 22 Sep 2015 10:00:01 +0200 Subject: fixing use of wrong array length (bad), and misc leaks --- src/mint/taler-mint-httpd_refresh.c | 94 ++++++++++++------------------------- 1 file changed, 30 insertions(+), 64 deletions(-) (limited to 'src/mint/taler-mint-httpd_refresh.c') diff --git a/src/mint/taler-mint-httpd_refresh.c b/src/mint/taler-mint-httpd_refresh.c index 29fd4baea..4d89fe892 100644 --- a/src/mint/taler-mint-httpd_refresh.c +++ b/src/mint/taler-mint-httpd_refresh.c @@ -417,10 +417,8 @@ handle_refresh_melt_json (struct MHD_Connection *connection, &denom_pubs[i].rsa_public_key); if (GNUNET_OK != res) { - for (j=0;jrefresh_link = TALER_refresh_link_encrypted_decode (link_enc, @@ -563,19 +539,11 @@ handle_refresh_melt_json (struct MHD_Connection *connection, TMH_PARSE_JNC_RET_DATA, &rcl->transfer_pub, sizeof (struct TALER_TransferPublicKeyP)); - if (GNUNET_OK != res) { GNUNET_break_op (0); - GNUNET_break (GNUNET_SYSERR != res); - GNUNET_CRYPTO_hash_context_abort (hash_context); - free_commit_coins (commit_coin, - TALER_CNC_KAPPA, - num_newcoins); - free_commit_links (commit_link, - TALER_CNC_KAPPA, - num_oldcoins); - return (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES; + res = (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES; + goto cleanup; } res = TMH_PARSE_navigate_json (connection, secret_encs, @@ -584,30 +552,20 @@ handle_refresh_melt_json (struct MHD_Connection *connection, TMH_PARSE_JNC_RET_DATA, &rcl->shared_secret_enc, sizeof (struct TALER_EncryptedLinkSecretP)); - if (GNUNET_OK != res) { GNUNET_break_op (0); - GNUNET_break (GNUNET_SYSERR != res); - GNUNET_CRYPTO_hash_context_abort (hash_context); - free_commit_coins (commit_coin, - TALER_CNC_KAPPA, - num_newcoins); - free_commit_links (commit_link, - TALER_CNC_KAPPA, - num_oldcoins); - return (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES; + res = (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES; + goto cleanup; } - GNUNET_CRYPTO_hash_context_read (hash_context, rcl, sizeof (struct TALER_RefreshCommitLinkP)); } - } GNUNET_CRYPTO_hash_context_finish (hash_context, &session_hash); - + hash_context = NULL; for (i=0;i