Skip to content

Commit

Permalink
Ensure rowbasis and colbasis are freed.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmtroffaes committed Sep 18, 2024
1 parent 6214b66 commit 639b9c2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cython/pycddlib.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,11 @@ def matrix_rank(
rank = dd_MatrixRank(
mat.dd_mat, dd_ignored_rows, dd_ignored_cols, &rowbasis, &colbasis
)
result = (_get_set(rowbasis), _get_set(colbasis), rank)
set_free(rowbasis)
set_free(colbasis)
try:
result = (_get_set(rowbasis), _get_set(colbasis), rank)
finally:
set_free(rowbasis)
set_free(colbasis)
finally:
set_free(dd_ignored_cols)
finally:
Expand Down

0 comments on commit 639b9c2

Please sign in to comment.