Skip to content

Commit

Permalink
fix coverity 1271722 (destructor, leak), re #11328
Browse files Browse the repository at this point in the history
  • Loading branch information
FedeMPouzols committed Mar 12, 2015
1 parent 590375b commit 6fcbfae
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions Code/Mantid/Framework/MDEvents/src/CoordTransformAffine.cpp
Expand Up @@ -41,6 +41,20 @@ CoordTransformAffine::CoordTransformAffine(const size_t inD, const size_t outD)
// Copy into the raw matrix (for speed)
copyRawMatrix();
}

//----------------------------------------------------------------------------------------------
/** Destructor
*/
CoordTransformAffine::~CoordTransformAffine() {
// delete array of pointers to rows
delete[] m_rawMatrix;
m_rawMatrix = NULL;

// delete large mem block holding the matrix
delete[] m_rawMemory;
m_rawMemory = NULL;
}

//----------------------------------------------------------------------------------------------
/** Copies the affine matrix into a local raw pointer, for speed.
* Call this after any change to affineMatrix
Expand All @@ -60,18 +74,6 @@ CoordTransform *CoordTransformAffine::clone() const {
return out;
}

//----------------------------------------------------------------------------------------------
/** Destructor
*/
CoordTransformAffine::~CoordTransformAffine() {
if (m_rawMatrix) {
delete[] * m_rawMatrix;
delete[] m_rawMatrix;
}
m_rawMatrix = NULL;
m_rawMemory = NULL;
}

//----------------------------------------------------------------------------------------------
/** Directly set the affine matrix to use.
*
Expand Down

0 comments on commit 6fcbfae

Please sign in to comment.