exchange

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

commit 3ff5bad33e2abf67fa1fb015304c3c6bbd88a82b
parent 88e611d32b7ce7adda7fde271c62f7ffb8c6f1fe
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun, 17 Feb 2019 00:13:14 +0100

fix memory leak: on repeated refresh reveal, we populated ev_sigs twice

Diffstat:
Msrc/exchange/taler-exchange-httpd_refresh_reveal.c | 15++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd_refresh_reveal.c b/src/exchange/taler-exchange-httpd_refresh_reveal.c @@ -195,11 +195,16 @@ check_exists_cb (void *cls, GNUNET_break_op (0 == memcmp (tprivs, &rctx->transfer_privs, sizeof (struct TALER_TransferPrivateKeyP) * num_tprivs)); - rctx->ev_sigs = GNUNET_new_array (num_newcoins, - struct TALER_DenominationSignature); - for (unsigned int i=0;i<num_newcoins;i++) - rctx->ev_sigs[i].rsa_signature - = GNUNET_CRYPTO_rsa_signature_dup (rrcs[i].coin_sig.rsa_signature); + /* We usually sign early (optimistic!), but in case we change that *and* + we do find the operation in the database, we could use this: */ + if (NULL == rctx->ev_sigs) + { + rctx->ev_sigs = GNUNET_new_array (num_newcoins, + struct TALER_DenominationSignature); + for (unsigned int i=0;i<num_newcoins;i++) + rctx->ev_sigs[i].rsa_signature + = GNUNET_CRYPTO_rsa_signature_dup (rrcs[i].coin_sig.rsa_signature); + } }