summaryrefslogtreecommitdiff
path: root/tests/basic.c
diff options
context:
space:
mode:
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>2014-01-25 03:21:39 +0400
committerWerner Koch <wk@gnupg.org>2014-01-27 14:33:33 +0100
commit5c150ece094bf0a504a111ce6c7b72e8d0b0457a (patch)
treee8a5cec45e886448b472eaa9d45990d75ed19c9c /tests/basic.c
parent6d87e6abdfb7552323a95401f14e6367398a3e5a (diff)
downloadlibgcrypt-5c150ece094bf0a504a111ce6c7b72e8d0b0457a.tar.gz
Fix most of memory leaks in tests code
* tests/basic.c (check_ccm_cipher): Close cipher after use. * tests/basic.c (check_one_cipher): Correct length of used buffer. * tests/benchmark.c (cipher_bench): Use xcalloc to make buffer initialized. * tests/keygen.c (check_ecc_keys): Release generated key. * tests/t-mpi-point.c (context_param): Release mpi Q. * tests/t-sexp.c (check_extract_param): Release extracted number. -- The only remaining reported memory leak is one expected leak from mpitests.c. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Diffstat (limited to 'tests/basic.c')
-rw-r--r--tests/basic.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/basic.c b/tests/basic.c
index e85e4e17..4474a9de 100644
--- a/tests/basic.c
+++ b/tests/basic.c
@@ -2213,6 +2213,8 @@ check_ccm_cipher (void)
if (memcmp (buf, tag, taglen) != 0)
fail ("cipher-ccm-large, encrypt mismatch entry\n");
+
+ gcry_cipher_close (hde);
}
#if 0
@@ -2305,6 +2307,8 @@ check_ccm_cipher (void)
if (memcmp (buf, tag, taglen) != 0)
fail ("cipher-ccm-huge, encrypt mismatch entry\n");
+
+ gcry_cipher_close (hde);
}
if (verbose)
@@ -3496,7 +3500,7 @@ check_one_cipher (int algo, int mode, int flags)
return;
/* Pass 2: Key not aligned and data not aligned. */
- memmove (plain+1, plain, 1024);
+ memmove (plain+1, plain, 1040);
if (check_one_cipher_core (algo, mode, flags, key+1, 32, plain+1, 1040,
bufshift, 2+10*bufshift))
return;