[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-merchant] 04/04: fix test memory leaks
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-merchant] 04/04: fix test memory leaks |
Date: |
Tue, 16 Jan 2018 13:14:19 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant.
commit 4446b157ba179e85224c8acb59a1d8ab2791e0ae
Author: Christian Grothoff <address@hidden>
AuthorDate: Tue Jan 16 13:12:05 2018 +0100
fix test memory leaks
---
src/lib/merchant_api_tip_pickup.c | 3 +++
src/lib/test_merchant_api.c | 26 ++++++++++++++++----------
2 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/src/lib/merchant_api_tip_pickup.c
b/src/lib/merchant_api_tip_pickup.c
index e967588..cc84cea 100644
--- a/src/lib/merchant_api_tip_pickup.c
+++ b/src/lib/merchant_api_tip_pickup.c
@@ -189,6 +189,7 @@ handle_tip_pickup_finished (void *cls,
break;
}
if (NULL != tpo->cb)
+ {
tpo->cb (tpo->cb_cls,
response_code,
TALER_JSON_get_error_code (json),
@@ -196,6 +197,8 @@ handle_tip_pickup_finished (void *cls,
0,
NULL,
json);
+ tpo->cb = NULL;
+ }
TALER_MERCHANT_tip_pickup_cancel (tpo);
}
diff --git a/src/lib/test_merchant_api.c b/src/lib/test_merchant_api.c
index e967966..219b407 100644
--- a/src/lib/test_merchant_api.c
+++ b/src/lib/test_merchant_api.c
@@ -2200,7 +2200,8 @@ pickup_withdraw_cb (void *cls,
wh->wsh = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Withdraw operation completed with %u/%u\n",
+ "Withdraw operation %u completed with %u (%d)\n",
+ wh->off,
http_status,
ec);
GNUNET_assert (wh->off < cmd->details.tip_pickup.num_coins);
@@ -2289,6 +2290,7 @@ pickup_cb (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Obtained %u signatures for withdrawal from picking up a tip\n",
num_reserve_sigs);
+ GNUNET_assert (NULL == cmd->details.tip_pickup.withdraws);
cmd->details.tip_pickup.withdraws
= GNUNET_new_array (num_reserve_sigs,
struct WithdrawHandle);
@@ -2298,6 +2300,9 @@ pickup_cb (void *cls,
wh->off = i;
wh->is = is;
+ GNUNET_assert ( (NULL == wh->wsh) &&
+ ( (NULL == cmd->details.tip_pickup.sigs) ||
+ (NULL ==
cmd->details.tip_pickup.sigs[wh->off].rsa_signature) ) );
wh->wsh = TALER_EXCHANGE_reserve_withdraw2 (exchange,
cmd->details.tip_pickup.dks[i],
&reserve_sigs[i],
@@ -2624,12 +2629,14 @@ cleanup_state (struct InterpreterState *is)
{
for (unsigned int j=0;j<cmd->details.tip_pickup.num_coins;j++)
{
- if (NULL != cmd->details.reserve_withdraw.sig.rsa_signature)
+ if (NULL != cmd->details.tip_pickup.sigs[j].rsa_signature)
{
GNUNET_CRYPTO_rsa_signature_free
(cmd->details.tip_pickup.sigs[j].rsa_signature);
cmd->details.tip_pickup.sigs[j].rsa_signature = NULL;
}
}
+ GNUNET_free (cmd->details.tip_pickup.sigs);
+ cmd->details.tip_pickup.sigs = NULL;
}
break;
default:
@@ -3749,14 +3756,13 @@ interpreter_run (void *cls)
}
}
if (NULL == (cmd->details.tip_pickup.tpo
- = TALER_MERCHANT_tip_pickup
- (ctx,
- MERCHANT_URL,
- &ref->details.tip_authorize.tip_id,
- num_planchets,
- planchets,
- &pickup_cb,
- is)))
+ = TALER_MERCHANT_tip_pickup (ctx,
+ MERCHANT_URL,
+
&ref->details.tip_authorize.tip_id,
+ num_planchets,
+ planchets,
+ &pickup_cb,
+ is)))
{
GNUNET_break (0);
fail (is);
--
To stop receiving notification emails like this one, please contact
address@hidden