summaryrefslogtreecommitdiffstats
path: root/test/bntest.c
diff options
context:
space:
mode:
authorFdaSilvaYY <fdasilvayy@gmail.com>2016-03-18 23:17:39 +0100
committerRich Salz <rsalz@openssl.org>2016-04-06 06:17:21 -0400
commitf0e1fe7cc30b22d9e24ac38f0d4631f9b8042e12 (patch)
treef5d6d12ca8afae7d8e537c97e7d459be5e599395 /test/bntest.c
parent570c0716e30ca3490cc8f5d8d7cf25bcd99d6c7c (diff)
Add missing mem leak test activation and checks
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'test/bntest.c')
-rw-r--r--test/bntest.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/bntest.c b/test/bntest.c
index e58d94d117..1ba903254b 100644
--- a/test/bntest.c
+++ b/test/bntest.c
@@ -154,6 +154,9 @@ int main(int argc, char *argv[])
BIO *out;
char *outfile = NULL;
+ CRYPTO_set_mem_debug(1);
+ CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
+
results = 0;
RAND_seed(rnd_seed, sizeof rnd_seed); /* or BN_generate_prime may fail */
@@ -353,12 +356,20 @@ int main(int argc, char *argv[])
BN_CTX_free(ctx);
BIO_free(out);
+ ERR_print_errors_fp(stderr);
+
+#ifndef OPENSSL_NO_CRYPTO_MDEBUG
+ if (CRYPTO_mem_leaks_fp(stderr) <= 0)
+ EXIT(1);
+#endif
EXIT(0);
err:
BIO_puts(out, "1\n"); /* make sure the Perl script fed by bc
* notices the failure, see test_bn in
* test/Makefile.ssl */
(void)BIO_flush(out);
+ BN_CTX_free(ctx);
+ BIO_free(out);
ERR_print_errors_fp(stderr);
EXIT(1);