View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012149VTK(No Category)public2011-05-04 03:342013-12-12 23:27
ReporterJohn Stark. 
Assigned ToRobert Maynard 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version6.0.0 
Summary0012149: vtkDataReader: leaks memory in IsFileValid
DescriptionNot 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 ReproduceCall vtkDataReader::IsFileValid with a file that does not contain "dataset" on the first line. Observe that this->CloseVTKFile() is not called.
Additional InformationTo fix, add
this->CloseVTKFile();
just before the return 0; from this function.

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

TagsNo tags attached.
Project
Type
Attached Files

 Relationships

  Notes
(0026429)
John Stark. (reporter)
2011-05-04 07:13

Also, in the same function, the following test needs to be split:
  if (!this->OpenVTKFile() || !this->ReadHeader() )
    {
    return 0;
    }

In the case the file is opened, the file needs to be closed even if ReadHeader fails, to give
  if (!this->OpenVTKFile())
    {
    return 0;
    }

  if ( !this->ReadHeader() )
    {
    this->CloseVTKFile ();
    return 0;
    }
(0027427)
Benoit Bleuze (reporter)
2011-08-25 04:40

Hi there,
I just also noticed this issue, is there any news on the matter?
It is quite an easy fix, and the reporter provided a solution, but I think I haven't seen any change on the git repos so far.

Thank you for any updates.
(0027747)
John Stark (reporter)
2011-11-30 04:10

Submitted patch to gerrit :
http://review.source.kitware.com/#change,3405 [^]
(0031926)
Dave DeMarle (administrator)
2013-12-12 23:27

commit 46514f9 merged pre 6.0.0

 Issue History
Date Modified Username Field Change
2011-05-04 03:34 John Stark. New Issue
2011-05-04 07:13 John Stark. Note Added: 0026429
2011-05-04 07:51 David Partyka Assigned To => Robert Maynard
2011-05-04 07:51 David Partyka Status backlog => tabled
2011-06-16 13:12 Zack Galbreath Category Development => (No Category)
2011-08-25 04:40 Benoit Bleuze Note Added: 0027427
2011-11-30 04:10 John Stark Note Added: 0027747
2013-12-12 23:27 Dave DeMarle Note Added: 0031926
2013-12-12 23:27 Dave DeMarle Status backlog => closed
2013-12-12 23:27 Dave DeMarle Resolution open => fixed
2013-12-12 23:27 Dave DeMarle Fixed in Version => 6.0.0


Copyright © 2000 - 2018 MantisBT Team