summaryrefslogtreecommitdiff
path: root/cipher/ecc.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2015-07-10 10:15:26 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2015-07-10 10:15:26 +0900
commit2a7aa3ea4d03a9c808d5888f5509c08cd27aa27c (patch)
tree4e5074c5af722a944896bb30befdcaa4cd75b641 /cipher/ecc.c
parent0a7547e487a8bc4e7ac9599c55579eb2e4a13f06 (diff)
downloadlibgcrypt-2a7aa3ea4d03a9c808d5888f5509c08cd27aa27c.tar.gz
ecc: fix memory leak.
* cipher/ecc.c (ecc_verify): Release memory which was allocated before by _gcry_pk_util_preparse_sigval. (ecc_decrypt_raw): Likewise. -- Caught by LeakSanitizer (LSan). Now the test suite (make check) passes with no memleaks. Signed-off-by: Peter Wu <peter@lekensteyn.nl> The last commit (0a7547e487a8bc4e7ac9599c55579eb2e4a13f06) includes wrong fixes for sexp_release. ecc_decrypt_raw fix added by gniibe.
Diffstat (limited to 'cipher/ecc.c')
-rw-r--r--cipher/ecc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/cipher/ecc.c b/cipher/ecc.c
index f5bc50aa..e33f9990 100644
--- a/cipher/ecc.c
+++ b/cipher/ecc.c
@@ -1041,6 +1041,7 @@ ecc_verify (gcry_sexp_t s_sig, gcry_sexp_t s_data, gcry_sexp_t s_keyparms)
goto leave;
}
/* Add missing parameters using the optional curve parameter. */
+ sexp_release (l1);
l1 = sexp_find_token (s_keyparms, "curve", 5);
if (l1)
{
@@ -1417,6 +1418,7 @@ ecc_decrypt_raw (gcry_sexp_t *r_plain, gcry_sexp_t s_data, gcry_sexp_t keyparms)
goto leave;
}
/* Add missing parameters using the optional curve parameter. */
+ sexp_release (l1);
l1 = sexp_find_token (keyparms, "curve", 5);
if (l1)
{