Home GnuPG

Fix memory leaks in ecc code
a180117d20ecUnpublished

Unpublished Commit · Learn More

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

Description

Fix memory leaks in ecc code

* cipher/ecc-curves.c (_gcry_ecc_update_curve_param): Release passed mpi
  values.
* cipher/ecc.c (compute_keygrip): Fix potential memory leak in error
  path.
* cipher/ecc.c (_gcry_ecc_get_curve): Release temporary mpi.

11657== 252 (80 direct, 172 indirect) bytes in 4 blocks are definitely lost in loss record 8 of 8

11657== at 0x4028A28: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)

11657== by 0x404178F: _gcry_private_malloc (stdmem.c:113)

11657== by 0x403CED1: do_malloc.constprop.4 (global.c:768)

11657== by 0x403DD01: _gcry_xmalloc (global.c:790)

11657== by 0x409EAE0: _gcry_mpi_alloc (mpiutil.c:84)

11657== by 0x409C4E4: _gcry_mpi_scan (mpicoder.c:466)

11657== by 0x404009C: _gcry_sexp_nth_mpi (sexp.c:796)

11657== by 0x40410B5: _gcry_sexp_vextract_param (sexp.c:2327)

11657== by 0x4041396: _gcry_sexp_extract_param (sexp.c:2378)

11657== by 0x407B895: compute_keygrip (ecc.c:1492)

11657== by 0x404BBE8: _gcry_pk_get_keygrip (pubkey.c:674)

11657== by 0x403B1BF: gcry_pk_get_keygrip (visibility.c:1056)

16502== 144 (60 direct, 84 indirect) bytes in 3 blocks are definitely lost in loss record 3 of 7

16502== at 0x4028A28: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)

16502== by 0x404B4DE: _gcry_private_malloc (stdmem.c:113)

16502== by 0x404667B: do_malloc (global.c:768)

16502== by 0x40466E7: _gcry_malloc (global.c:790)

16502== by 0x4046A55: _gcry_xmalloc (global.c:944)

16502== by 0x40CD25B: _gcry_mpi_alloc (mpiutil.c:84)

16502== by 0x40CAC3E: _gcry_mpi_scan (mpicoder.c:548)

16502== by 0x40A72B2: scanval (ecc-curves.c:432)

16502== by 0x40A7B0D: _gcry_ecc_get_curve (ecc-curves.c:685)

16502== by 0x4058164: _gcry_pk_get_curve (pubkey.c:747)

16502== by 0x4043E14: gcry_pk_get_curve (visibility.c:1067)

16502== by 0x8048934: check_matching (curves.c:124)

(cherry picked from commit 6d87e6abdfb7552323a95401f14e6367398a3e5a)

  • Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>

Details

Provenance
lumagAuthored on Jan 25 2014, 12:21 AM
wernerCommitted on Jan 27 2014, 2:36 PM
Parents
rC04d478d9b0f9: Check compiler features only for the relevant platform.
Branches
Unknown
Tags
Unknown

Event Timeline

Werner Koch <wk@gnupg.org> committed rCa180117d20ec: Fix memory leaks in ecc code (authored by Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>).Jan 27 2014, 2:36 PM