Commit f620aa83 authored by Mikaël Salson's avatar Mikaël Salson

Fasta: Memory leak with sequence.seq

Array was allocated at each call in next().
It is now free-ed when necessary
parent a7d6a5c6
......@@ -115,11 +115,14 @@ OnlineFasta::OnlineFasta(const OnlineFasta &of) {
OnlineFasta::~OnlineFasta() {
if (input_allocated)
delete input;
if (current.seq)
delete [] current.seq;
}
void OnlineFasta::init() {
line_nb = 0;
line = getInterestingLine();
current.seq = NULL;
}
size_t OnlineFasta::getLineNb() {
......@@ -142,7 +145,8 @@ void OnlineFasta::next() {
current.label.erase();
current.sequence.erase();
current.quality.erase();
current.seq = NULL;
if (current.seq)
delete [] current.seq;
if (hasNext()) {
switch(line[0]) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment