From e5f25b65532d5a446fed205ab18dcbcf8e584b9e Mon Sep 17 00:00:00 2001 From: Karel Miko Date: Mon, 19 Jun 2017 20:09:20 +0200 Subject: [PATCH] tests+timing - silence valgrind warning (memleak) --- demos/timing.c | 1 + tests/file_test.c | 4 +++- tests/rsa_test.c | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/demos/timing.c b/demos/timing.c index f91f6f4..0c06a6c 100644 --- a/demos/timing.c +++ b/demos/timing.c @@ -674,6 +674,7 @@ static const struct { } t2 >>= 2; fprintf(stderr, "DSA-(%lu, %lu) make_key took %15"PRI64"u cycles\n", (unsigned long)groups[x].group*8, (unsigned long)groups[x].modulus*8, t2); + dsa_free(&key); } fprintf(stderr, "\n\n"); } diff --git a/tests/file_test.c b/tests/file_test.c index c2e4a38..8cb4eaf 100644 --- a/tests/file_test.c +++ b/tests/file_test.c @@ -23,7 +23,9 @@ int file_test(void) len = sizeof(buf); if ((in = fopen(fname, "rb")) == NULL) return CRYPT_FILE_NOTFOUND; - if ((err = hash_filehandle(isha256, in, buf, &len)) != CRYPT_OK) return err; + err = hash_filehandle(isha256, in, buf, &len); + fclose(in); + if (err != CRYPT_OK) return err; if (compare_testvector(buf, len, exp_sha256, 32, "hash_filehandle", 1)) return 1; len = sizeof(buf); diff --git a/tests/rsa_test.c b/tests/rsa_test.c index 5352be8..754127c 100644 --- a/tests/rsa_test.c +++ b/tests/rsa_test.c @@ -193,6 +193,7 @@ static int rsa_compat_test(void) fprintf(stderr, "RSA rsa_verify_hash_ex + LTC_PKCS_1_V1_5_NA1 failed\n"); return 1; } + rsa_free(&pubkey); /* now try to export private/public and compare */ len = sizeof(buf);