diff --git a/src/kzg_proofs.c b/src/kzg_proofs.c index c3b185d..58ed142 100644 --- a/src/kzg_proofs.c +++ b/src/kzg_proofs.c @@ -79,8 +79,8 @@ C_KZG_RET compute_proof_multi(blst_p1 *out, const KZGSettings *ks, poly *p, cons commit_to_poly(out, ks, &q); - free_poly(q); - free_poly(divisor); + free_poly(&q); + free_poly(&divisor); return C_KZG_OK; } diff --git a/src/kzg_proofs_test.c b/src/kzg_proofs_test.c index bbaf210..21d00a5 100644 --- a/src/kzg_proofs_test.c +++ b/src/kzg_proofs_test.c @@ -75,7 +75,7 @@ void proof_single(void) { TEST_CHECK(true == check_proof_single(&ks, &commitment, &proof, &x, &value)); free_fft_settings(&fs); - free_poly(p); + free_poly(&p); free(s1); free(s2); } @@ -128,7 +128,7 @@ void proof_multi(void) { free_fft_settings(&fs1); free_fft_settings(&fs2); - free_poly(p); + free_poly(&p); free(s1); free(s2); } @@ -145,7 +145,7 @@ void proof_single_error(void) { fr_from_uint64(&x, 1234); TEST_CHECK(C_KZG_BADARGS == compute_proof_single(&proof, &ks, &p, &x)); - free_poly(p); + free_poly(&p); } TEST_LIST = diff --git a/src/poly.c b/src/poly.c index 7bf71a7..bf68673 100644 --- a/src/poly.c +++ b/src/poly.c @@ -26,8 +26,8 @@ void init_poly(poly *out, const uint64_t length) { out->coeffs = malloc(length * sizeof(blst_fr)); } -void free_poly(poly p) { - free(p.coeffs); +void free_poly(poly *p) { + free(p->coeffs); } void eval_poly(blst_fr *out, const poly *p, const blst_fr *x) { diff --git a/src/poly.h b/src/poly.h index 64dc960..8230dd9 100644 --- a/src/poly.h +++ b/src/poly.h @@ -24,7 +24,7 @@ typedef struct { } poly; void init_poly(poly *out, const uint64_t length); -void free_poly(poly p); +void free_poly(poly *p); void eval_poly(blst_fr *out, const poly *p, const blst_fr *x); C_KZG_RET poly_quotient_length(uint64_t *out, const poly *dividend, const poly *divisor); C_KZG_RET poly_long_div(poly *out, const poly *dividend, const poly *divisor);