Skip to content

Commit

Permalink
fix heap-use-after-free error
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaGuarracino committed May 27, 2024
1 parent 13931c6 commit 76d19ca
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/common/wflign/src/wflign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,7 @@ void WFlign::wflign_affine_wavefront(

// Free
delete wflambda_aligner;
delete wf_aligner;

#ifdef WFA_PNG_TSV_TIMING
if (extend_data.emit_png) {
Expand Down Expand Up @@ -972,9 +973,6 @@ void WFlign::wflign_affine_wavefront(
}

if (merge_alignments) {
// Free old aligner
delete wf_aligner;

// use biWFA for all patching
wfa::WFAlignerGapAffine2Pieces* wf_aligner =
new wfa::WFAlignerGapAffine2Pieces(
Expand Down Expand Up @@ -1029,7 +1027,9 @@ void WFlign::wflign_affine_wavefront(
emit_patching_tsv,
out_patching_tsv
#endif
);
);

delete wf_aligner;
} else {
// todo old implementation (and SAM format is not supported)
for (auto x = trace.rbegin(); x != trace.rend(); ++x) {
Expand All @@ -1050,9 +1050,6 @@ void WFlign::wflign_affine_wavefront(
}
}
}

// Free
delete wf_aligner;
}
}

Expand Down

0 comments on commit 76d19ca

Please sign in to comment.