Commit 695cf3a9 authored by kraus's avatar kraus
Browse files

fixing leak in Pilot / SamplePilot and rewrite construct valgrind somehow doesn't like

parent 99deefa2
......@@ -60,10 +60,12 @@ void Inform::setup(const char *myname, int pnode) {
MsgLevel = MIN_INFORM_LEVEL;
PrintNode = pnode;
if ( myname != 0 )
Name = strcpy(new char[strlen(myname) + 1], myname);
else
if ( myname != 0 ) {
Name = new char[strlen(myname) + 1];
strcpy(Name, myname);
} else {
Name = 0;
}
}
......@@ -290,4 +292,4 @@ Inform& Inform::outputMessage(void) {
* $RCSfile: Inform.cpp,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:33 $
* IPPL_VERSION_ID: $Id: Inform.cpp,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $
***************************************************************************/
***************************************************************************/
\ No newline at end of file
......@@ -129,8 +129,14 @@ public:
setup(known_expr_funcs);
}
~Pilot()
{}
virtual ~Pilot()
{
for (auto itr = objectives_.begin(); itr != objectives_.end(); ++ itr)
delete itr->second;
for (auto itr = constraints_.begin(); itr != constraints_.end(); ++ itr)
delete itr->second;
}
protected:
......
......@@ -76,7 +76,7 @@ public:
this->setup(known_expr_funcs, storeobjstr);
}
~SamplePilot()
virtual ~SamplePilot()
{}
......
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