[vtk-developers] [VTK 0012149]: vtkDataReader: leaks memory in IsFileValid

Mantis Bug Tracker mantis at public.kitware.com
Wed May 4 03:34:32 EDT 2011


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=12149 
====================================================================== 
Reported By:                John Stark.
Assigned To:                
====================================================================== 
Project:                    VTK
Issue ID:                   12149
Category:                   Development
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2011-05-04 03:34 EDT
Last Modified:              2011-05-04 03:34 EDT
====================================================================== 
Summary:                    vtkDataReader: leaks memory in IsFileValid
Description: 
Not all return paths from the function given below result in the file being
closed. 
int vtkDataReader::IsFileValid(const char *dstype)
This results in a leak of a std::istream object (m_IS) every time the function
is called on a broad set of files.


Steps to Reproduce: 
Call vtkDataReader::IsFileValid with a file that does not contain "dataset" on
the first line. Observe that this->CloseVTKFile() is not called. 


Additional Information: 
To fix, add 
this->CloseVTKFile();
just before the return 0; from this function.

And / Or
Always delete the existing m_IS in vtkDataReader::OpenVTKFile();


====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-05-04 03:34 John Stark.    New Issue                                    
======================================================================




More information about the vtk-developers mailing list