Skip to content

Commit

Permalink
fix(multilinear-extensions): address concerns of double free on copy
Browse files Browse the repository at this point in the history
  • Loading branch information
mratsim committed Jul 6, 2024
1 parent a401fc8 commit acbfc48
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions constantine/boolean_hypercube/multilinear_extensions.nim
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ type
num_vars*: int
base_poly_evals*: ptr UncheckedArray[F]

proc `=wasMoved`*[F](mle: var MultilinearExtension[F]) =
mle.base_poly_evals = nil

proc `=destroy`*[F](mle: var MultilinearExtension[F]) =
if not mle.base_poly_evals.isNil:
freeHeapAligned(mle.base_poly_evals)
Expand Down

0 comments on commit acbfc48

Please sign in to comment.