Home GnuPG

ecc: Fix some memory leaks
c4f9af49f228Unpublished

Unpublished Commit · Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.

Description

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.

Details

Provenance
Christian Grothoff <christian@grothoff.org>Authored on Nov 11 2013, 4:04 PM
wernerCommitted on Nov 13 2013, 9:46 AM
Parents
rC4fb3c8e5a7fc: ecc: Change keygrip computation for Ed25519+EdDSA.
Branches
Unknown
Tags
Unknown

Event Timeline

Werner Koch <wk@gnupg.org> committed rCc4f9af49f228: ecc: Fix some memory leaks (authored by Christian Grothoff <christian@grothoff.org>).Nov 13 2013, 9:46 AM