View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013908VTK(No Category)public2013-02-26 17:592013-04-05 18:56
ReporterMicah Chambers 
Assigned ToBerk Geveci 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0013908: Memory Leak in the following code
DescriptionvtkDataReader.cxx has a memory leak here: 'decoded' is allocated but never deleted. Line 1749 of the git version.

    else
      {
      // read in newline
      vtkStdString s;
      my_getline(*(this->IS), s);

      for (int i=0; i<numTuples; i++)
        {
        for (int j=0; j<numComp; j++)
          {
          my_getline(*(this->IS), s);
          int length = static_cast<int>(s.length());
          char* decoded = new char[length + 1];
          int decodedLength = this->DecodeString(decoded, s.c_str());
          vtkStdString decodedStr(decoded, decodedLength);
          ((vtkStringArray*)array)->InsertNextValue(decodedStr);
          }
        }
      }
    }
TagsNo tags attached.
ProjectTBD
Typeperformance
Attached Filespatch file icon vtkDataReader.patch [^] (936 bytes) 2013-02-26 18:16 [Show Content]
? file icon testcorr.vtk [^] (290,635 bytes) 2013-02-26 18:28

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0030388)
Jean-Christophe Fillion-Robin (manager)
2013-02-26 18:06

Hi Micah,

Thanks for pointing this out. Would be great if you could submit a patch that would be discussed by the community :)

See http://www.vtk.org/Wiki/VTK/Git/Develop [^]
(0030389)
Micah Chambers (reporter)
2013-02-26 18:16

Yeah I'm testing the patch now...
(0030390)
Micah Chambers (reporter)
2013-02-26 18:28

Yeah, ran valgrind on my code and it works. I don't have sample code though, because its part of kind of a big codebase. I will however attach a sample dataset where the bug occurs. Reading the dataset with vtkDataSetReader will definitely recreate the bug. While I was there I went ahead and added delete[] to several other 'decoded' variables. I think this was a copy-and-paste error.
(0030398)
Berk Geveci (administrator)
2013-03-02 20:22

Committed a fix for this to Gerrit review. Please see

http://review.source.kitware.com/#/t/2278 [^]

Feel free to register to Gerrit and comment.

- Issue History
Date Modified Username Field Change
2013-02-26 17:59 Micah Chambers New Issue
2013-02-26 18:06 Jean-Christophe Fillion-Robin Note Added: 0030388
2013-02-26 18:16 Micah Chambers File Added: vtkDataReader.patch
2013-02-26 18:16 Micah Chambers Note Added: 0030389
2013-02-26 18:28 Micah Chambers File Added: testcorr.vtk
2013-02-26 18:28 Micah Chambers Note Added: 0030390
2013-03-02 20:21 Berk Geveci Assigned To => Berk Geveci
2013-03-02 20:21 Berk Geveci Status backlog => tabled
2013-03-02 20:22 Berk Geveci Note Added: 0030398
2013-03-02 20:22 Berk Geveci Status tabled => customer review
2013-03-02 20:22 Berk Geveci Resolution open => fixed
2013-04-05 18:56 Berk Geveci Status customer review => closed


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker