MantisBT - VTK
View Issue Details
0005815VTK(No Category)public2007-10-02 04:582014-02-18 08:57
xabi riobe 
Dave DeMarle 
normalminoralways
closedfixed 
 
6.2.0 
TBD
incorrect functionality
0005815: memory leak when failing to write with vtkPNGWriter
There are some memory leaks if a vtkPNGWriter fails to write a file if we are out of disk space.

Here comes a diff patch to avoid this:

@@ -198,6 +198,8 @@
   this->TempFP = 0;
+ png_byte **row_pointers;
+
   if (this->WriteToMemory)
     {
     vtkUnsignedCharArray *uc = this->GetResult();
@@ -227,6 +229,9 @@
       if (setjmp(png_ptr->jmpbuf))
         {
         fclose(this->TempFP);
+ if(row_pointers)
+ delete [] row_pointers;
+ png_destroy_write_struct(&png_ptr, &info_ptr);
         this->SetErrorCode(vtkErrorCode::OutOfDiskSpaceError);
         return;
         }
@@ -272,7 +277,7 @@
     png_set_swap(png_ptr);
 #endif
     }
- png_byte **row_pointers = new png_byte *[height];
+ row_pointers = new png_byte *[height];
   vtkIdType *outInc = data->GetIncrements();
   vtkIdType rowInc = outInc[1]*bit_depth/8;
   for (ui = 0; ui < height; ui++)

No tags attached.
Issue History
2007-10-02 04:58xabi riobeNew Issue
2008-08-29 17:23David ColeStatusbacklog => tabled
2008-08-29 17:23David ColeAssigned To => David Cole
2011-01-19 09:45David ColeAssigned ToDavid Cole => David Partyka
2011-06-16 13:11Zack GalbreathCategory => (No Category)
2013-07-22 20:33Dave DeMarleStatusbacklog => expired
2013-07-22 20:33Dave DeMarleNote Added: 0031300
2013-09-30 08:41xabi riobeNote Added: 0031659
2013-09-30 08:41xabi riobeStatusexpired => backlog
2013-09-30 08:41xabi riobeResolutionopen => reopened
2013-09-30 09:36xabi riobeNote Added: 0031667
2013-09-30 09:36xabi riobeStatusbacklog => gerrit review
2013-12-16 11:36Dave DeMarleProject => TBD
2013-12-16 11:36Dave DeMarleType => incorrect functionality
2013-12-16 11:36Dave DeMarleNote Added: 0031940
2013-12-16 11:36Dave DeMarleAssigned ToDavid Partyka => Dave DeMarle
2013-12-16 11:36Dave DeMarleStatusgerrit review => backlog
2014-01-14 05:52xabi riobeStatusbacklog => gerrit review
2014-02-18 08:57Dave DeMarleNote Added: 0032345
2014-02-18 08:57Dave DeMarleStatusgerrit review => closed
2014-02-18 08:57Dave DeMarleResolutionreopened => fixed
2014-02-18 08:57Dave DeMarleFixed in Version => 6.2.0

Notes
(0031300)
Dave DeMarle   
2013-07-22 20:33   
Dave P no longer works on the project. If these old issues still exist in 6.0.0, reopen them and assign to Dave DeMarle
(0031659)
xabi riobe   
2013-09-30 08:41   
The issue is still present in 6.0.0
(0031667)
xabi riobe   
2013-09-30 09:36   
http://review.source.kitware.com/#/t/3344 [^]
(0031940)
Dave DeMarle   
2013-12-16 11:36   
problems in gerrit, reverting to backlog until after 6.1
(0032345)
Dave DeMarle   
2014-02-18 08:57   
http://review.source.kitware.com/#/t/3344/ [^]