exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit f099e574dacd91756cc806ec77520ea5e50b700d
parent fa07c79d81733bae7823dc70de5f013f0a1fc9f0
Author: Christian Grothoff <grothoff@gnunet.org>
Date:   Wed, 15 Jul 2026 18:23:34 +0200

-fix leak

Diffstat:
Msrc/bank-lib/fakebank_common_transact.c | 29+++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/src/bank-lib/fakebank_common_transact.c b/src/bank-lib/fakebank_common_transact.c @@ -133,9 +133,11 @@ TALER_FAKEBANK_transact_ (struct TALER_FAKEBANK_Handle *h, } GNUNET_assert (0 == pthread_mutex_unlock (&h->big_lock)); - if ( (NULL != old) && - (T_DEBIT == old->type) ) + if (NULL == old) + return; + switch (old->type) { + case T_DEBIT: GNUNET_assert (0 == pthread_mutex_lock (&h->uuid_map_lock)); GNUNET_assert (GNUNET_OK == @@ -144,6 +146,29 @@ TALER_FAKEBANK_transact_ (struct TALER_FAKEBANK_Handle *h, old)); GNUNET_assert (0 == pthread_mutex_unlock (&h->uuid_map_lock)); + break; + case T_CREDIT: + { + const struct GNUNET_PeerIdentity *pid + = (const struct GNUNET_PeerIdentity *) &old->subject.credit.reserve_pub; + + /* admin transfers are indexed in rpubs by reserve_pub; drop the + secondary index before freeing to avoid a dangling pointer */ + GNUNET_assert (0 == + pthread_mutex_lock (&h->rpubs_lock)); + GNUNET_assert (GNUNET_OK == + GNUNET_CONTAINER_multipeermap_remove (h->rpubs, + pid, + old)); + GNUNET_assert (0 == + pthread_mutex_unlock (&h->rpubs_lock)); + } + break; + case T_AUTH: + /* FIXME: anything to clean up? */ + break; + case T_WAD: + break; } GNUNET_free (old); }