From 5c2a4fad1cca052462095e3da9f3a224ed63bd73 Mon Sep 17 00:00:00 2001 From: Andrew Poelstra Date: Thu, 16 Apr 2015 15:56:04 -0500 Subject: [PATCH] Fix memory leak in context unit test Before fix, `valgrind ./tests 1` outputs ==21959== in use at exit: 2,228,288 bytes in 8 blocks after: ==23974== in use at exit: 0 bytes in 0 blocks --- src/tests.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tests.c b/src/tests.c index df26b9a093684..d391488b61b08 100644 --- a/src/tests.c +++ b/src/tests.c @@ -142,6 +142,12 @@ void run_context_tests(void) { /* try verifying */ CHECK(secp256k1_ecdsa_sig_verify(&vrfy->ecmult_ctx, &sig, &pub, &msg)); CHECK(secp256k1_ecdsa_sig_verify(&both->ecmult_ctx, &sig, &pub, &msg)); + + /* cleanup */ + secp256k1_context_destroy(none); + secp256k1_context_destroy(sign); + secp256k1_context_destroy(vrfy); + secp256k1_context_destroy(both); } /***** HASH TESTS *****/