diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-11-11 16:04:30 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2013-11-13 09:46:32 +0100 |
commit | c4f9af49f228df59c218381a25fa3c0f93ccbeae (patch) | |
tree | c447e87a6854d017cd90f41a0063b6d308806e3e /cipher/ecc-eddsa.c | |
parent | 4fb3c8e5a7fc6a1568f54bcc0be17fecf75e0742 (diff) | |
download | libgcrypt-c4f9af49f228df59c218381a25fa3c0f93ccbeae.tar.gz |
ecc: Fix some memory leaks
* cipher/ecc-curves.c (_gcry_mpi_ec_new): Free ec->b before assigning.
* cipher/ecc.c (nist_generate_key): Release Q.
* cipher/ecc-eddsa.c (_gcry_ecc_eddsa_genkey): Ditto.
--
_gcry_mpi_ec_new: Fixing memory leak detected with valgrind; if 'b' is
non-NULL, the code in ec_p_init (ec.c:379) already makes a copy of
'b', so before we clobber ctx->b here, we need to at least release the
old value (however, it would of course be nicer to not first make a
copy of b in the first place, but this is the most localized change to
get rid of the memory leak).
nist_generate_key: Fixing rather obvious local leak; Q is first
initialized, then used, copied into the result but never released.
Diffstat (limited to 'cipher/ecc-eddsa.c')
-rw-r--r-- | cipher/ecc-eddsa.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/cipher/ecc-eddsa.c b/cipher/ecc-eddsa.c index b9e866d9..92c0713f 100644 --- a/cipher/ecc-eddsa.c +++ b/cipher/ecc-eddsa.c @@ -432,6 +432,7 @@ _gcry_ecc_eddsa_genkey (ECC_secret_key *sk, elliptic_curve_t *E, mpi_ec_t ctx, point_set (&sk->Q, &Q); leave: + point_free (&Q); gcry_mpi_release (a); gcry_mpi_release (x); gcry_mpi_release (y); |