Commit c5cb5ad6 authored by Cyprien Borée's avatar Cyprien Borée Committed by Mikaël Salson
Browse files

Free memory in Filter and Germline

Since the Germline now contains a Filter object instead of an automaton
and respectively Filter contains the automaton. Both of them have to
free the memory allocated correctly.

For more informations, see #3283.
parent 204400b8
......@@ -5,7 +5,8 @@ FilterWithACAutomaton::FilterWithACAutomaton(BioReader &origin, string seed){
}
FilterWithACAutomaton::~FilterWithACAutomaton(){
delete p->first;
delete p->second;
}
void FilterWithACAutomaton::buildACAutomatonToFilterBioReader
......
......@@ -214,14 +214,8 @@ FilterWithACAutomaton* Germline::getFilter(){
Germline::~Germline()
{
if(automaton_5){
if(automaton_5->first){
delete automaton_5->first;
}
if(automaton_5->second){
delete automaton_5->second;
}
delete automaton_5;
if(filter){
delete filter;
}
if (index)
{
......
......@@ -247,9 +247,7 @@ void testAutomatonBuilderFilteringBioReader(){
TEST_LABEL_ERROR);
}
}
delete pair1->first; delete pair1->second; delete pair1;
delete pair2->first; delete pair2->second; delete pair2;
delete pair3->first; delete pair3->second; delete pair3;
delete f1; delete f2; delete f3;
}
void testFilterBioReaderWithACAutomaton(){
......@@ -337,10 +335,7 @@ void testFilterBioReaderWithACAutomaton(){
TEST_FILTER_BIOREADER_WITH_AC_AUTOMATON, GENES_ERROR);
}
}
delete pair1->first, delete pair1->second; delete pair1;
delete pair2->first; delete pair2->second; delete pair2;
delete pair3->first; delete pair3->second; delete pair3;
delete f1; delete f2; delete f3;
}
void testGetNSignicativeKmers(){
......@@ -364,6 +359,7 @@ void testGetNSignicativeKmers(){
Sequence seq = germline.rep_5.read(i);
FilterWithACAutomaton *f = germline.getFilter();
filtered = f->filterBioReaderWithACAutomaton(germline.rep_5, seq.sequence, 1);
delete f;
int j = 0;
while(j < filtered.size()){
if(extractGeneName(filtered.label(j)) == extractGeneName(seq.label)){
......
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