diff --git a/src/fits/GFits.cpp b/src/fits/GFits.cpp index 04ee21f..7b68ecc 100644 --- a/src/fits/GFits.cpp +++ b/src/fits/GFits.cpp @@ -857,6 +857,9 @@ void GFits::remove(const int& extno) throw GException::invalid_argument(G_REMOVE1, msg); } + // Delete HDU + if (m_hdu[extno] != NULL) delete m_hdu[extno]; + // Erase HDU from FITS file m_hdu.erase(m_hdu.begin() + extno); diff --git a/src/obs/GObservations.cpp b/src/obs/GObservations.cpp index 2376df6..558dbce 100644 --- a/src/obs/GObservations.cpp +++ b/src/obs/GObservations.cpp @@ -400,6 +400,9 @@ void GObservations::remove(const int& index) } #endif + // Delete observation + delete m_obs[index]; + // Erase observation component from container m_obs.erase(m_obs.begin() + index); diff --git a/src/sky/GSkyRegions.cpp b/src/sky/GSkyRegions.cpp index b9e1b54..08d2e89 100644 --- a/src/sky/GSkyRegions.cpp +++ b/src/sky/GSkyRegions.cpp @@ -542,6 +542,9 @@ void GSkyRegions::remove(const int& index) } #endif + // Delete region + delete m_regions[index]; + // Erase region component from container m_regions.erase(m_regions.begin() + index); @@ -570,6 +573,9 @@ void GSkyRegions::remove(const std::string& name) throw GException::invalid_argument(G_REMOVE2, name); } + // Delete region + delete m_regions[index]; + // Erase region component from container m_regions.erase(m_regions.begin() + index); diff --git a/src/xml/GXmlNode.cpp b/src/xml/GXmlNode.cpp index e86ee9d..c905287 100644 --- a/src/xml/GXmlNode.cpp +++ b/src/xml/GXmlNode.cpp @@ -354,6 +354,9 @@ void GXmlNode::remove(const int& index) } #endif + // Delete node + delete m_nodes[index]; + // Erase child node from container m_nodes.erase(m_nodes.begin() + index);