Skip to content

Commit

Permalink
fix memory leak in _mzd_ple_submatrix
Browse files Browse the repository at this point in the history
  • Loading branch information
maple3142 committed Oct 24, 2024
1 parent 775189b commit c642e4e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion m4ri/ple_russian.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,11 @@ int _mzd_ple_submatrix(mzd_t *A, rci_t const start_row, rci_t const stop_row, rc
wi_t os[__M4RI_PLE_NTABLES * __M4RI_MAXKAY];

mzd_t *B = A;
int window_used = 0;
if (A->width > splitblock) {
A = mzd_init_window(A, 0, 0, A->nrows, splitblock * m4ri_radix);
assert(!(A->flags & mzd_flag_nonzero_excess));
window_used = 1;
}

int curr_pos;
Expand Down Expand Up @@ -173,7 +175,9 @@ int _mzd_ple_submatrix(mzd_t *A, rci_t const start_row, rci_t const stop_row, rc
for (rci_t r2 = done[c2] + 1; r2 <= *done_row; ++r2)
if (mzd_read_bit(A, r2, start_col + pivots[c2]))
mzd_row_add_offset(A, r2, start_row + c2, start_col + pivots[c2] + 1);


if (window_used)
mzd_free_window(A);
A = B;
__M4RI_DD_MZD(A);
__M4RI_DD_MZP(P);
Expand Down

0 comments on commit c642e4e

Please sign in to comment.