Skip to content

Commit 02dd5f1

Browse files
committed
free the ctx at the end of bench_ecdh
1 parent e9fccd4 commit 02dd5f1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/bench_ecdh.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ static void bench_ecdh_setup(void* arg) {
2828
0xa2, 0xba, 0xd1, 0x84, 0xf8, 0x83, 0xc6, 0x9f
2929
};
3030

31-
/* create a context with no capabilities */
32-
data->ctx = secp256k1_context_create(SECP256K1_FLAGS_TYPE_CONTEXT);
3331
for (i = 0; i < 32; i++) {
3432
data->scalar[i] = i + 1;
3533
}
@@ -49,6 +47,11 @@ static void bench_ecdh(void* arg) {
4947
int main(void) {
5048
bench_ecdh_data data;
5149

50+
/* create a context with no capabilities */
51+
data.ctx = secp256k1_context_create(SECP256K1_FLAGS_TYPE_CONTEXT);
52+
5253
run_benchmark("ecdh", bench_ecdh, bench_ecdh_setup, NULL, &data, 10, 20000);
54+
55+
secp256k1_context_destroy(data.ctx);
5356
return 0;
5457
}

0 commit comments

Comments
 (0)