Skip to content

Commit 5c2a4fa

Browse files
committed
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
1 parent 14aacdc commit 5c2a4fa

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/tests.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ void run_context_tests(void) {
142142
/* try verifying */
143143
CHECK(secp256k1_ecdsa_sig_verify(&vrfy->ecmult_ctx, &sig, &pub, &msg));
144144
CHECK(secp256k1_ecdsa_sig_verify(&both->ecmult_ctx, &sig, &pub, &msg));
145+
146+
/* cleanup */
147+
secp256k1_context_destroy(none);
148+
secp256k1_context_destroy(sign);
149+
secp256k1_context_destroy(vrfy);
150+
secp256k1_context_destroy(both);
145151
}
146152

147153
/***** HASH TESTS *****/

0 commit comments

Comments
 (0)