MediaArea / MediaInfoLib

Convenient unified display of the most relevant technical and tag data for video and audio files.
https://mediaarea.net/MediaInfo
BSD 2-Clause "Simplified" License
638 stars 177 forks source link

Memory leak when reading compressed headers in PNGs #2120

Closed luis-vsn closed 1 month ago

luis-vsn commented 1 month ago

Hello mantainers,

I have found a memory leak when referencing the library from another project. It leaks memory when PNG files have compressed headres so they need to be uncompressed using zlib.

PoC cursed.zip

To reproduce it, just add a loop after main analysis in HowToUse_Dll.cpp:

MI.Close();
int i = 0;
do {
    MI.Open(__T("cursed.png"));
    MI.Close();
} while (i++ < 1000);

This leak does not apply when analyzing the file with CLI.

JeromeMartinez commented 1 month ago

https://github.com/MediaArea/MediaInfoLib/pull/2121