Skip to content

Commit 18e0db3

Browse files
tests: Don't recreate global context in scratch space test
1 parent b198061 commit 18e0db3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/tests.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -325,12 +325,10 @@ void run_scratch_tests(void) {
325325
secp256k1_scratch_space *scratch;
326326
secp256k1_scratch_space local_scratch;
327327

328-
ctx = secp256k1_context_create(SECP256K1_CONTEXT_NONE);
329-
330-
/* Test public API */
331328
secp256k1_context_set_illegal_callback(ctx, counting_illegal_callback_fn, &ecount);
332329
secp256k1_context_set_error_callback(ctx, counting_illegal_callback_fn, &ecount);
333330

331+
/* Test public API */
334332
scratch = secp256k1_scratch_space_create(ctx, 1000);
335333
CHECK(scratch != NULL);
336334
CHECK(ecount == 0);
@@ -397,7 +395,9 @@ void run_scratch_tests(void) {
397395

398396
/* cleanup */
399397
secp256k1_scratch_space_destroy(ctx, NULL); /* no-op */
400-
secp256k1_context_destroy(ctx);
398+
399+
secp256k1_context_set_illegal_callback(ctx, NULL, NULL);
400+
secp256k1_context_set_error_callback(ctx, NULL, NULL);
401401
}
402402

403403

0 commit comments

Comments
 (0)