summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-06-29 14:06:37 +0200
committerChristian Grothoff <christian@grothoff.org>2022-06-29 14:06:37 +0200
commit9902e88b2d9dceb948275cf17b7ff62002da6fe3 (patch)
treecf38dd51ee4b929a3d41b500193d795ed197d1ff /src
parent60a30b1c75644710d635c2efa4bccf440e1839b4 (diff)
downloadexchange-9902e88b2d9dceb948275cf17b7ff62002da6fe3.tar.gz
exchange-9902e88b2d9dceb948275cf17b7ff62002da6fe3.tar.bz2
exchange-9902e88b2d9dceb948275cf17b7ff62002da6fe3.zip
-fix leaks
Diffstat (limited to 'src')
-rw-r--r--src/exchange/taler-exchange-httpd_purses_create.c13
-rw-r--r--src/exchange/taler-exchange-httpd_purses_deposit.c8
2 files changed, 20 insertions, 1 deletions
diff --git a/src/exchange/taler-exchange-httpd_purses_create.c b/src/exchange/taler-exchange-httpd_purses_create.c
index e227f2395..ba827428a 100644
--- a/src/exchange/taler-exchange-httpd_purses_create.c
+++ b/src/exchange/taler-exchange-httpd_purses_create.c
@@ -440,7 +440,6 @@ parse_coin (struct MHD_Connection *connection,
coin,
jcoin)))
return iret;
-
if (GNUNET_OK !=
(iret = TEH_common_deposit_check_purse_deposit (
connection,
@@ -594,6 +593,8 @@ TEH_handler_purses_create (
if (GNUNET_OK != res)
{
GNUNET_JSON_parse_free (spec);
+ for (unsigned int i = 0; i<idx; i++)
+ TEH_common_deposit_free_coin (&pcc.coins[i]);
GNUNET_free (pcc.coins);
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
}
@@ -624,6 +625,8 @@ TEH_handler_purses_create (
{
TALER_LOG_WARNING ("Invalid signature on /purses/$PID/create request\n");
GNUNET_JSON_parse_free (spec);
+ for (unsigned int i = 0; i<pcc.num_coins; i++)
+ TEH_common_deposit_free_coin (&pcc.coins[i]);
GNUNET_free (pcc.coins);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_FORBIDDEN,
@@ -640,6 +643,8 @@ TEH_handler_purses_create (
{
TALER_LOG_WARNING ("Invalid signature on /purses/$PID/create request\n");
GNUNET_JSON_parse_free (spec);
+ for (unsigned int i = 0; i<pcc.num_coins; i++)
+ TEH_common_deposit_free_coin (&pcc.coins[i]);
GNUNET_free (pcc.coins);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_FORBIDDEN,
@@ -653,6 +658,8 @@ TEH_handler_purses_create (
{
GNUNET_break (0);
GNUNET_JSON_parse_free (spec);
+ for (unsigned int i = 0; i<pcc.num_coins; i++)
+ TEH_common_deposit_free_coin (&pcc.coins[i]);
GNUNET_free (pcc.coins);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
@@ -673,6 +680,8 @@ TEH_handler_purses_create (
&pcc))
{
GNUNET_JSON_parse_free (spec);
+ for (unsigned int i = 0; i<pcc.num_coins; i++)
+ TEH_common_deposit_free_coin (&pcc.coins[i]);
GNUNET_free (pcc.coins);
return mhd_ret;
}
@@ -684,6 +693,8 @@ TEH_handler_purses_create (
res = reply_create_success (connection,
&pcc);
+ for (unsigned int i = 0; i<pcc.num_coins; i++)
+ TEH_common_deposit_free_coin (&pcc.coins[i]);
GNUNET_free (pcc.coins);
GNUNET_JSON_parse_free (spec);
return res;
diff --git a/src/exchange/taler-exchange-httpd_purses_deposit.c b/src/exchange/taler-exchange-httpd_purses_deposit.c
index 87e2f5689..059ff03e3 100644
--- a/src/exchange/taler-exchange-httpd_purses_deposit.c
+++ b/src/exchange/taler-exchange-httpd_purses_deposit.c
@@ -415,6 +415,8 @@ TEH_handler_purses_deposit (
if (GNUNET_OK != res)
{
GNUNET_JSON_parse_free (spec);
+ for (unsigned int i = 0; i<idx; i++)
+ TEH_common_deposit_free_coin (&pcc.coins[i]);
GNUNET_free (pcc.coins);
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
}
@@ -425,6 +427,8 @@ TEH_handler_purses_deposit (
{
GNUNET_break (0);
GNUNET_JSON_parse_free (spec);
+ for (unsigned int i = 0; i<pcc.num_coins; i++)
+ TEH_common_deposit_free_coin (&pcc.coins[i]);
GNUNET_free (pcc.coins);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
@@ -445,6 +449,8 @@ TEH_handler_purses_deposit (
&pcc))
{
GNUNET_JSON_parse_free (spec);
+ for (unsigned int i = 0; i<pcc.num_coins; i++)
+ TEH_common_deposit_free_coin (&pcc.coins[i]);
GNUNET_free (pcc.coins);
return mhd_ret;
}
@@ -471,6 +477,8 @@ TEH_handler_purses_deposit (
res = reply_deposit_success (connection,
&pcc);
+ for (unsigned int i = 0; i<pcc.num_coins; i++)
+ TEH_common_deposit_free_coin (&pcc.coins[i]);
GNUNET_free (pcc.coins);
GNUNET_JSON_parse_free (spec);
return res;