summaryrefslogtreecommitdiff
path: root/src/exchange
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-10-29 23:06:48 +0100
committerChristian Grothoff <christian@grothoff.org>2023-10-29 23:06:48 +0100
commitfc7800d320d5508a1bada7dc47d60cc46a96200f (patch)
treef67e2d9e3302e84316edfc78761c77661d415a31 /src/exchange
parent9bad35f229933fc9d0f6d80e3ed9f8de804c86bd (diff)
downloadexchange-fc7800d320d5508a1bada7dc47d60cc46a96200f.tar.gz
exchange-fc7800d320d5508a1bada7dc47d60cc46a96200f.tar.bz2
exchange-fc7800d320d5508a1bada7dc47d60cc46a96200f.zip
misc age-restriction related memory leak fixes, plus FIXME-Oec as some leaks remain
Diffstat (limited to 'src/exchange')
-rw-r--r--src/exchange/taler-exchange-httpd_age-withdraw.c15
-rw-r--r--src/exchange/taler-exchange-httpd_age-withdraw_reveal.c15
-rw-r--r--src/exchange/taler-exchange-httpd_refreshes_reveal.c2
3 files changed, 20 insertions, 12 deletions
diff --git a/src/exchange/taler-exchange-httpd_age-withdraw.c b/src/exchange/taler-exchange-httpd_age-withdraw.c
index 56065dda8..bcbb71563 100644
--- a/src/exchange/taler-exchange-httpd_age-withdraw.c
+++ b/src/exchange/taler-exchange-httpd_age-withdraw.c
@@ -231,11 +231,17 @@ parse_age_withdraw_json (
json_array_foreach (j_kappa_coin_evs, kappa, value) {
struct GNUNET_JSON_Specification spec[] = {
- TALER_JSON_spec_blinded_planchet (NULL, &awc->coin_evs[off + kappa]),
+ /* FIXME-Oec: This allocation is never freed! */
+ TALER_JSON_spec_blinded_planchet (NULL,
+ &awc->coin_evs[off + kappa]),
GNUNET_JSON_spec_end ()
};
+
if (GNUNET_OK !=
- GNUNET_JSON_parse (value, spec, NULL, NULL))
+ GNUNET_JSON_parse (value,
+ spec,
+ NULL,
+ NULL))
{
GNUNET_snprintf (buf,
sizeof(buf),
@@ -249,12 +255,11 @@ parse_age_withdraw_json (
/* Continue to hash of the coin candidates */
{
struct TALER_BlindedCoinHashP bch;
+
ret = TALER_coin_ev_hash (&awc->coin_evs[off + kappa],
&awc->denom_hs[idx],
&bch);
-
GNUNET_assert (GNUNET_OK == ret);
-
GNUNET_CRYPTO_hash_context_read (hash_context,
&bch,
sizeof(bch));
@@ -830,7 +835,7 @@ age_withdraw_transaction (void *cls,
* @param connection HTTP-connection to the client
* @param awc The context for the current age withdraw request
* @param[out] result On error, a HTTP-response will be queued and result set accordingly
- * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
*/
static enum GNUNET_GenericReturnValue
sign_and_do_age_withdraw (
diff --git a/src/exchange/taler-exchange-httpd_age-withdraw_reveal.c b/src/exchange/taler-exchange-httpd_age-withdraw_reveal.c
index 7463d2225..9b9f1cb88 100644
--- a/src/exchange/taler-exchange-httpd_age-withdraw_reveal.c
+++ b/src/exchange/taler-exchange-httpd_age-withdraw_reveal.c
@@ -194,8 +194,8 @@ EXIT:
* @param reserve_pub Reserve public key used in the original age-withdraw request
* @param[out] commitment Data from the original age-withdraw request
* @param[out] result In the error cases, a response will be queued with MHD and this will be the result.
- * @return GNUNET_OK if the withdraw request has been found,
- * GNUNET_SYSERROR if we did not find the request in the DB
+ * @return #GNUNET_OK if the withdraw request has been found,
+ * #GNUNET_SYSERR if we did not find the request in the DB
*/
static enum GNUNET_GenericReturnValue
find_original_commitment (
@@ -217,20 +217,17 @@ find_original_commitment (
{
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
return GNUNET_OK; /* Only happy case */
-
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
*result = TALER_MHD_reply_with_error (connection,
MHD_HTTP_NOT_FOUND,
TALER_EC_EXCHANGE_AGE_WITHDRAW_COMMITMENT_UNKNOWN,
NULL);
return GNUNET_SYSERR;
-
case GNUNET_DB_STATUS_HARD_ERROR:
*result = TALER_MHD_reply_with_ec (connection,
TALER_EC_GENERIC_DB_FETCH_FAILED,
"get_age_withdraw_info");
return GNUNET_SYSERR;
-
case GNUNET_DB_STATUS_SOFT_ERROR:
break; /* try again */
default:
@@ -300,6 +297,7 @@ calculate_blinded_hash (
&acp);
TALER_age_commitment_hash (&acp.commitment,
&ach);
+ TALER_age_commitment_proof_free (&acp);
}
/* Next: calculate planchet */
@@ -362,7 +360,7 @@ calculate_blinded_hash (
ret = TALER_coin_ev_hash (&detail.blinded_planchet,
&denom_key->h_denom_pub,
bch);
-
+ TALER_blinded_planchet_free (&detail.blinded_planchet);
GNUNET_assert (GNUNET_OK == ret);
}
@@ -599,6 +597,11 @@ TEH_handler_age_withdraw_reveal (
} while(0);
GNUNET_JSON_parse_free (spec);
+ for (unsigned int i = 0; i<actx.num_coins; i++)
+ TALER_blinded_denom_sig_free (&actx.commitment.denom_sigs[i]);
+ GNUNET_free (actx.commitment.denom_sigs);
+ GNUNET_free (actx.commitment.denom_pub_hashes);
+ GNUNET_free (actx.commitment.denom_serials);
GNUNET_free (actx.disclosed_coin_secrets);
return result;
}
diff --git a/src/exchange/taler-exchange-httpd_refreshes_reveal.c b/src/exchange/taler-exchange-httpd_refreshes_reveal.c
index 0509bc90a..5630051cf 100644
--- a/src/exchange/taler-exchange-httpd_refreshes_reveal.c
+++ b/src/exchange/taler-exchange-httpd_refreshes_reveal.c
@@ -314,9 +314,9 @@ check_commitment (struct RevealContext *rctx,
&acp,
&ts.key,
&nacp));
-
TALER_age_commitment_hash (&nacp.commitment,
&h);
+ TALER_age_commitment_proof_free (&nacp);
hac = &h;
}