From 9391ed529c5b20dd8ad1114e28ca1e6dcb1de190 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 19 May 2016 18:37:31 +0200 Subject: export function to free commit coin data --- src/exchangedb/test_exchangedb.c | 38 ++++++++++---------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) (limited to 'src/exchangedb/test_exchangedb.c') diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c index e15d657e5..a5530e3cc 100644 --- a/src/exchangedb/test_exchangedb.c +++ b/src/exchangedb/test_exchangedb.c @@ -293,31 +293,6 @@ static struct TALER_Amount fee_refund; static struct TALER_Amount amount_with_fee; -/** - * Free memory associated with @a commit_coins. - * - * @param commit_coins memory to release - * @param size size of the @a commit_coins array - */ -static void -free_refresh_commit_coins_array (struct TALER_EXCHANGEDB_RefreshCommitCoin *commit_coins, - unsigned int size) -{ - unsigned int cnt; - struct TALER_EXCHANGEDB_RefreshCommitCoin *ccoin; - struct TALER_RefreshLinkEncrypted *rlink; - - for (cnt = 0; cnt < size; cnt++) - { - ccoin = &commit_coins[cnt]; - GNUNET_free_non_null (ccoin->coin_ev); - rlink = (struct TALER_RefreshLinkEncrypted *) ccoin->refresh_link; - GNUNET_free_non_null (rlink); - } - GNUNET_free (commit_coins); -} - - /** * Compare two coin encrypted refresh links. * @@ -474,7 +449,12 @@ test_refresh_commit_coins (struct TALER_EXCHANGEDB_Session *session, drop: if (NULL != ret_commit_coins) - free_refresh_commit_coins_array (ret_commit_coins, MELT_NEW_COINS); + { + plugin->free_refresh_commit_coins (plugin->cls, + MELT_NEW_COINS, + ret_commit_coins); + GNUNET_free (ret_commit_coins); + } return ret; } @@ -811,8 +791,10 @@ test_melting (struct TALER_EXCHANGEDB_Session *session) for (cnt=0;cntfree_refresh_commit_coins (plugin->cls, + MELT_NEW_COINS, + commit_coins[cnt]); + GNUNET_free (commit_coins[cnt]); commit_coins[cnt] = NULL; } if (NULL != dkp) -- cgit v1.2.3