Skip to content

Commit 9aac008

Browse files
committed
secp256k1_context_destroy: Allow NULL argument as a no-op
1 parent 64b730b commit 9aac008

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

include/secp256k1.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ secp256k1_context_t* secp256k1_context_clone(
160160
*/
161161
void secp256k1_context_destroy(
162162
secp256k1_context_t* ctx
163-
) SECP256K1_ARG_NONNULL(1);
163+
);
164164

165165
/** Set a callback function to be called when an illegal argument is passed to
166166
* an API call. It will only trigger for violations that are mentioned

src/secp256k1.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ secp256k1_context_t* secp256k1_context_clone(const secp256k1_context_t* ctx) {
8585
}
8686

8787
void secp256k1_context_destroy(secp256k1_context_t* ctx) {
88+
if (!ctx)
89+
return;
90+
8891
secp256k1_ecmult_context_clear(&ctx->ecmult_ctx);
8992
secp256k1_ecmult_gen_context_clear(&ctx->ecmult_gen_ctx);
9093

0 commit comments

Comments
 (0)