Memory leak in DiPNGPlugin::write

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
AlexanderLysenko
Posts: 19
Joined: Tue, 2009-07-07, 14:18

Memory leak in DiPNGPlugin::write

#1 Post by AlexanderLysenko »

Hello!

I have found memory leak when exporting dicom file as .png files by using dcmtk 3.6.3.
Issue was reported as a 90% source of memory leak by using DebugDiag2 Memory leak analysis.
After that I have monitored memory usage in Visual Studio Memory usage profiler (enabled Heap analysis) and found increasing amount of instances of structures (declared as png_info *info_ptr) in DiPNGPlugin::write.
see dcmimage\libsrc\dipipng.cc

original line of code that causes the issue

// finish
png_destroy_write_struct( &png_ptr, NULL );


To fix this issue following patch must be applied:

// finish
png_destroy_write_struct( &png_ptr, &info_ptr);


This issue existed in 3.6.0 also.

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1445
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

Re: Memory leak in DiPNGPlugin::write

#2 Post by Marco Eichelberg »

Thank you very much for the bug report. I can confirm that the memory leak is present and that your proposed patch fixes the problem.
The memory leak has been present since the introduction of class DiPNGPlugin with DCMTK 3.5.3 in 2004.
The leak has been fixed now with commit #dd3d2034a, which should appear in the public git in a few days.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest