From 649b297f9cd1ee2a70a3d01e098c07b916332a93 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 28 Nov 2017 14:16:14 +0100 Subject: Fix memory leak in SART --- src/SartAlgorithm.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/SartAlgorithm.cpp b/src/SartAlgorithm.cpp index 5c8f59b..6d39107 100644 --- a/src/SartAlgorithm.cpp +++ b/src/SartAlgorithm.cpp @@ -46,6 +46,10 @@ void CSartAlgorithm::_clear() { CReconstructionAlgorithm2D::_clear(); m_piProjectionOrder = NULL; + m_piProjectionOrder = NULL; + m_pTotalRayLength = NULL; + m_pTotalPixelWeight = NULL; + m_iProjectionCount = 0; m_iCurrentProjection = 0; m_bIsInitialized = false; @@ -57,10 +61,19 @@ void CSartAlgorithm::_clear() void CSartAlgorithm::clear() { CReconstructionAlgorithm2D::clear(); - if (m_piProjectionOrder) { - delete[] m_piProjectionOrder; - m_piProjectionOrder = NULL; - } + + delete[] m_piProjectionOrder; + m_piProjectionOrder = NULL; + + delete m_pTotalRayLength; + m_pTotalRayLength = NULL; + + delete m_pTotalPixelWeight; + m_pTotalPixelWeight = NULL; + + delete m_pDiffSinogram; + m_pDiffSinogram = NULL; + m_iProjectionCount = 0; m_iCurrentProjection = 0; m_bIsInitialized = false; -- cgit v1.2.3