commit fc7404ba57c0924568baf58ac1229c311278a08b
parent 2078e278645731eb2b850cc3be24ee6131f14554
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Mon, 17 Aug 2026 17:20:00 +0200
fix leak
Diffstat:
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/exchange/taler-exchange-httpd_post-purses-PURSE_PUB-create.c b/src/exchange/taler-exchange-httpd_post-purses-PURSE_PUB-create.c
@@ -561,7 +561,9 @@ TEH_handler_purses_create (
deposit);
if (GNUNET_OK != res)
{
- for (unsigned int i = 0; i<idx; i++)
+ /* Note: coins[idx] may have been fully parsed before the
+ check failed, so it must be released as well. */
+ for (unsigned int i = 0; i<=idx; i++)
TEH_common_purse_deposit_free_coin (&pcc.coins[i]);
GNUNET_free (pcc.coins);
GNUNET_JSON_parse_free (spec);
@@ -573,6 +575,8 @@ TEH_handler_purses_create (
&pcc.deposit_total))
{
GNUNET_break_op (0);
+ for (unsigned int i = 0; i<pcc.num_coins; i++)
+ TEH_common_purse_deposit_free_coin (&pcc.coins[i]);
GNUNET_free (pcc.coins);
GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (connection,
diff --git a/src/exchange/taler-exchange-httpd_post-purses-PURSE_PUB-deposit.c b/src/exchange/taler-exchange-httpd_post-purses-PURSE_PUB-deposit.c
@@ -491,7 +491,9 @@ TEH_handler_purses_deposit (
deposit);
if (GNUNET_OK != res)
{
- for (unsigned int i = 0; i<idx; i++)
+ /* Note: coins[idx] may have been fully parsed before the
+ check failed, so it must be released as well. */
+ for (unsigned int i = 0; i<=idx; i++)
TEH_common_purse_deposit_free_coin (&pcc.coins[i]);
GNUNET_free (pcc.coins);
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;