Skip to content

Commit 9505fd1

Browse files
committed
ecmult_strauss_batch_prealloc_scratch: free state variable after use
1 parent fab4272 commit 9505fd1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/ecmult_impl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ static int secp256k1_strauss_scratch_alloc(const secp256k1_callback* error_callb
387387
*/
388388
static int secp256k1_ecmult_strauss_batch_prealloc_scratch(const secp256k1_callback* error_callback, secp256k1_scratch *scratch, secp256k1_gej *r, secp256k1_scalar *scratch_sclrs, secp256k1_gej *scratch_pts, const secp256k1_scalar *inp_g_sc, size_t n_points) {
389389
struct secp256k1_strauss_state state;
390+
const size_t scratch_checkpoint = secp256k1_scratch_checkpoint(error_callback, scratch);
390391

391392
secp256k1_gej_set_infinity(r);
392393
if (inp_g_sc == NULL && n_points == 0) {
@@ -398,6 +399,7 @@ static int secp256k1_ecmult_strauss_batch_prealloc_scratch(const secp256k1_callb
398399
}
399400

400401
secp256k1_ecmult_strauss_wnaf(&state, r, n_points, scratch_pts, scratch_sclrs, inp_g_sc);
402+
secp256k1_scratch_apply_checkpoint(error_callback, scratch, scratch_checkpoint);
401403
return 1;
402404
}
403405

0 commit comments

Comments
 (0)