Skip to content

Commit

Permalink
Fix small memory leak in generateCorrectionLayouts (that was also cau…
Browse files Browse the repository at this point in the history
…sing an assert in the previous commit to fail).
  • Loading branch information
brianwalenz committed Sep 5, 2020
1 parent fc2c3de commit 8a3b5e0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
9 changes: 3 additions & 6 deletions src/correction/generateCorrectionLayouts.C
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,10 @@ generateLayout(tgTig *layout,
children.insert(ovl[oo].b_iid);
}

// Use utgcns's stashContains() to get rid of extra coverage. This function removes
// extra coverage from the layout and stores it in the savedChildren object. We don't
// care about these, and can just delete them.
//
// stashContains() also sorts by position, so we're done after this.
// Dro excess coverage in the evidence by dropping short reads. This also
// sorts by position.

layout->stashContains(maxEvidenceCoverage);
layout->dropExcessCoverage(maxEvidenceCoverage);
}


Expand Down
12 changes: 10 additions & 2 deletions src/stores/tgTig.H
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,19 @@ public:
bool loadLayout(FILE *F);

void stashContains(double maxCov, tgTigStashed &S);
void stashContains(double maxCov) {
void unstashContains(void);

void dropExcessCoverage(double maxCov) {
tgTigStashed S;

stashContains(maxCov, S);

delete [] _stashed;

_stashedLen = 0;
_stashedMax = 0;
_stashed = NULL;
};
void unstashContains(void);

// Save and load a package of data needed to process this tig.

Expand Down

0 comments on commit 8a3b5e0

Please sign in to comment.