summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-02-17 00:13:14 +0100
committerChristian Grothoff <christian@grothoff.org>2019-02-17 00:13:14 +0100
commit3ff5bad33e2abf67fa1fb015304c3c6bbd88a82b (patch)
treef34606344aa84f6336ef31ad41a0c3565568e7ca
parent88e611d32b7ce7adda7fde271c62f7ffb8c6f1fe (diff)
downloadexchange-3ff5bad33e2abf67fa1fb015304c3c6bbd88a82b.tar.gz
exchange-3ff5bad33e2abf67fa1fb015304c3c6bbd88a82b.tar.bz2
exchange-3ff5bad33e2abf67fa1fb015304c3c6bbd88a82b.zip
fix memory leak: on repeated refresh reveal, we populated ev_sigs twice
-rw-r--r--src/exchange/taler-exchange-httpd_refresh_reveal.c15
1 files 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
index 8062410e3..6eaa286d7 100644
--- 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);
+ }
}