Commit e87db78eb5f08ac9e94c60e2ed74dfca4a6dd224
1 parent
17039a06
Properly delete elements before removing their pointers.
Delete statements have been added to the remove() method(s) so that the elements are properly deleted before the pointers are erased.
Showing
4 changed files
with
15 additions
and
0 deletions
src/fits/GFits.cpp
| ... | ... | @@ -857,6 +857,9 @@ void GFits::remove(const int& extno) |
| 857 | 857 | throw GException::invalid_argument(G_REMOVE1, msg); |
| 858 | 858 | } |
| 859 | 859 | |
| 860 | + // Delete HDU | |
| 861 | + if (m_hdu[extno] != NULL) delete m_hdu[extno]; | |
| 862 | + | |
| 860 | 863 | // Erase HDU from FITS file |
| 861 | 864 | m_hdu.erase(m_hdu.begin() + extno); |
| 862 | 865 | ... | ... |
src/obs/GObservations.cpp
src/sky/GSkyRegions.cpp
| ... | ... | @@ -542,6 +542,9 @@ void GSkyRegions::remove(const int& index) |
| 542 | 542 | } |
| 543 | 543 | #endif |
| 544 | 544 | |
| 545 | + // Delete region | |
| 546 | + delete m_regions[index]; | |
| 547 | + | |
| 545 | 548 | // Erase region component from container |
| 546 | 549 | m_regions.erase(m_regions.begin() + index); |
| 547 | 550 | |
| ... | ... | @@ -570,6 +573,9 @@ void GSkyRegions::remove(const std::string& name) |
| 570 | 573 | throw GException::invalid_argument(G_REMOVE2, name); |
| 571 | 574 | } |
| 572 | 575 | |
| 576 | + // Delete region | |
| 577 | + delete m_regions[index]; | |
| 578 | + | |
| 573 | 579 | // Erase region component from container |
| 574 | 580 | m_regions.erase(m_regions.begin() + index); |
| 575 | 581 | ... | ... |
src/xml/GXmlNode.cpp