Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory leak in _mzd_ple_submatrix #20

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading