]> Creatis software - gdcm.git/blobdiff - src/gdcmDicomDirStudy.cxx
* src/gdcmDocument.cxx : bug fix on potential memory leak
[gdcm.git] / src / gdcmDicomDirStudy.cxx
index b2ef75232fb7aeb66e340c5edf1ab671a6697fd8..058879eec7b5786f32e60c76a0c5d5536a62c9df 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirStudy.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/23 10:12:33 $
-  Version:   $Revision: 1.30 $
+  Date:      $Date: 2005/01/25 11:11:58 $
+  Version:   $Revision: 1.31 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -45,12 +45,7 @@ DicomDirStudy::DicomDirStudy(bool empty):
  */
 DicomDirStudy::~DicomDirStudy() 
 {
-   for(ListDicomDirSerie::iterator cc = Series.begin();
-                                   cc != Series.end();
-                                 ++cc )
-   {
-      delete *cc;
-   }
+   ClearSerie();
 }
 
 //-----------------------------------------------------------------------------
@@ -106,6 +101,20 @@ DicomDirSerie *DicomDirStudy::NewSerie()
    return st;
 } 
 
+/**
+ * \brief  Remove all series in the study 
+ */
+void DicomDirStudy::ClearSerie()
+{
+   for(ListDicomDirSerie::iterator cc = Series.begin();
+                                   cc != Series.end();
+                                 ++cc )
+   {
+      delete *cc;
+   }
+   Series.clear();
+}
+
 /**
  * \brief   Get the first entry while visiting the DicomDirSeries
  * \return  The first DicomDirSerie if found, otherwhise NULL