MantisBT - ITK
View Issue Details
0007003ITKpublic2008-05-13 01:342009-09-22 16:19
wen.feng.Qiu 
Mathieu Malaterre 
normalblocksometimes
closedfixed 
 
 
0007003: ITK Memory leak in gdcm::gdcmdocument.h , function ParseDES, invoke RemoveEntry, and the solved method
When use gdcm::File to load DICOM , there will memory leak .
Through track the invoke-list, i found that "ParseDES" invoke the function "RemoveEntry", but this function couldn't delete correctly.
The originally "RemoveEntry", and i add the statement to solve this program.


bool ElementSet::RemoveEntry( DocEntry *entryToRemove)
{
   const TagKey &key = entryToRemove->GetKey();
   if ( TagHT.count(key) == 1 )
   {
      TagHT.erase(key);
      delete entryToRemove;
      return true;
   }
   
   gdcmWarningMacro( "Key not present : " << key);
   return false ;
}

After modify,

bool ElementSet::RemoveEntry( DocEntry *entryToRemove)
{
   const TagKey &key = entryToRemove->GetKey();
   if ( TagHT.count(key) == 1 )
   {
      TagHT.erase(key);
      delete entryToRemove;
      return true;
   }
// summit add: to RemoveEntry delete correctly the entryToRemove

   delete entryToRemove;
   gdcmWarningMacro( "Key not present : " << key);
   return false ;
}
No tags attached.
duplicate of 0007004closed Mathieu Malaterre ITK Memory leak in gdcm::gdcmdocument.h , function ParseDES, invoke RemoveEntry, and the solved method 
cxx gdcmDocEntry.cxx (8,658) 2008-05-13 01:34
https://public.kitware.com/Bug/file/1456/gdcmDocEntry.cxx
Issue History
2008-05-13 01:34wen.feng.QiuNew Issue
2008-05-13 01:34wen.feng.QiuFile Added: gdcmDocEntry.cxx
2008-10-06 05:33Mathieu MalaterreStatusnew => assigned
2008-10-06 05:33Mathieu MalaterreAssigned To => Mathieu Malaterre
2008-11-30 09:01Mathieu MalaterreRelationship addedduplicate of 0007004
2008-11-30 09:01Mathieu MalaterreNote Added: 0014238
2008-11-30 09:01Mathieu MalaterreStatusassigned => closed
2008-11-30 09:01Mathieu MalaterreResolutionopen => fixed
2008-11-30 11:42Mathieu MalaterreStatusclosed => resolved
2009-09-22 16:19Mathieu MalaterreStatusresolved => closed

Notes
(0014238)
Mathieu Malaterre   
2008-11-30 09:01   
duplicate