From 47ef65b849e7007f70f889828d22ee56f134db0a Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Sat, 30 Jan 2010 22:46:07 +0000 Subject: [PATCH] Fixed a memory leak error, due to faulty logic in the destructor. --- Cantera/src/thermo/ThermoPhase.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Cantera/src/thermo/ThermoPhase.cpp b/Cantera/src/thermo/ThermoPhase.cpp index eb0e60250..61088dcd2 100644 --- a/Cantera/src/thermo/ThermoPhase.cpp +++ b/Cantera/src/thermo/ThermoPhase.cpp @@ -49,11 +49,13 @@ namespace Cantera { ThermoPhase::~ThermoPhase() { for (int k = 0; k < m_kk; k++) { - if (!m_speciesData[k]) { + if (m_speciesData[k]) { delete m_speciesData[k]; + m_speciesData[k] = 0; } } delete m_spthermo; + m_spthermo = 0; } /** @@ -95,8 +97,9 @@ namespace Cantera { * We need to destruct first */ for (int k = 0; k < m_kk; k++) { - if (!m_speciesData[k]) { + if (m_speciesData[k]) { delete m_speciesData[k]; + m_speciesData[k] = 0; } } if (m_spthermo) {