Fixed memory leakage due to missing deletion of the dynamically allocated MPC objects

git-svn-id: http://svn.sintef.no/trondheim/IFEM/trunk@1249 e10b68d5-8a6e-419e-a041-bce267b0401d
This commit is contained in:
kmo 2011-10-06 10:13:58 +00:00 committed by Knut Morten Okstad
parent 72833f8339
commit 63afe3044b
2 changed files with 13 additions and 2 deletions

View File

@ -29,6 +29,13 @@ ASMbase::ASMbase (unsigned char n_p, unsigned char n_s, unsigned char n_f)
}
ASMbase::~ASMbase ()
{
for (MPCIter it = mpcs.begin(); it != mpcs.end(); it++)
delete *it;
}
void ASMbase::clear (bool retainGeometry)
{
if (retainGeometry) // Clear all FE structures, including the elements
@ -37,8 +44,12 @@ void ASMbase::clear (bool retainGeometry)
for (size_t i = 0; i < MNPC.size(); i++) MNPC[i].clear();
// Erase the nodes, boundary conditions and multi-point constraints
for (MPCIter it = mpcs.begin(); it != mpcs.end(); it++)
delete *it;
MLGN.clear();
BCode.clear();
dCode.clear();
mpcs.clear();
}

View File

@ -75,8 +75,8 @@ protected:
ASMbase(unsigned char n_p, unsigned char n_s, unsigned char n_f);
public:
//! \brief Empty destructor.
virtual ~ASMbase() {}
//! \brief The destructor frees the dynamically allocated data objects.
virtual ~ASMbase();
//! \brief Checks if this patch is empty.
virtual bool empty() const = 0;