File tree Expand file tree Collapse file tree 4 files changed +13
-1
lines changed Expand file tree Collapse file tree 4 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ static void secp256k1_ecmult_gen_context_init(secp256k1_ecmult_gen_context* ctx)
3232static void secp256k1_ecmult_gen_context_build (secp256k1_ecmult_gen_context * ctx , const secp256k1_callback * cb );
3333static void secp256k1_ecmult_gen_context_clone (secp256k1_ecmult_gen_context * dst ,
3434 const secp256k1_ecmult_gen_context * src , const secp256k1_callback * cb );
35+ #ifndef USE_ECMULT_STATIC_PRECOMPUTATION
36+ static void secp256k1_ecmult_gen_context_teardown (secp256k1_ecmult_gen_context * ctx );
37+ #endif
3538static void secp256k1_ecmult_gen_context_clear (secp256k1_ecmult_gen_context * ctx );
3639static int secp256k1_ecmult_gen_context_is_built (const secp256k1_ecmult_gen_context * ctx );
3740
Original file line number Diff line number Diff line change @@ -112,10 +112,13 @@ static void secp256k1_ecmult_gen_context_clone(secp256k1_ecmult_gen_context *dst
112112 }
113113}
114114
115- static void secp256k1_ecmult_gen_context_clear (secp256k1_ecmult_gen_context * ctx ) {
116115#ifndef USE_ECMULT_STATIC_PRECOMPUTATION
116+ static void secp256k1_ecmult_gen_context_teardown (secp256k1_ecmult_gen_context * ctx ) {
117117 free (ctx -> prec );
118+ }
118119#endif
120+
121+ static void secp256k1_ecmult_gen_context_clear (secp256k1_ecmult_gen_context * ctx ) {
119122 SECP256K1_CLEANSE (ctx -> blind );
120123 SECP256K1_CLEANSE (ctx -> initial );
121124 ctx -> prec = NULL ;
Original file line number Diff line number Diff line change @@ -64,6 +64,9 @@ int main(int argc, char **argv) {
6464 }
6565 }
6666 fprintf (fp ,"};\n" );
67+ #ifndef USE_ECMULT_STATIC_PRECOMPUTATION
68+ secp256k1_ecmult_gen_context_teardown (& ctx );
69+ #endif
6770 secp256k1_ecmult_gen_context_clear (& ctx );
6871
6972 fprintf (fp , "#undef SC\n" );
Original file line number Diff line number Diff line change @@ -93,6 +93,9 @@ void secp256k1_context_destroy(secp256k1_context* ctx) {
9393 if (ctx != NULL ) {
9494 secp256k1_ecmult_context_teardown (& ctx -> ecmult_ctx );
9595 SECP256K1_CLEANSE (ctx -> ecmult_ctx );
96+ #ifndef USE_ECMULT_STATIC_PRECOMPUTATION
97+ secp256k1_ecmult_gen_context_teardown (& ctx -> ecmult_gen_ctx );
98+ #endif
9699 secp256k1_ecmult_gen_context_clear (& ctx -> ecmult_gen_ctx );
97100
98101 free (ctx );
You can’t perform that action at this time.
0 commit comments