madler / zlib

A massively spiffy yet delicately unobtrusive compression library.
http://zlib.net/
Other
5.46k stars 2.41k forks source link

Potential resource leak problem in mztools.c #982

Closed shinyano closed 4 weeks ago

shinyano commented 4 weeks ago

Hi,

I noticed that there is a file pointer fpOutCD in method unzRepair in file mztool.c which is not closed properly at the end. https://github.com/madler/zlib/blob/0f51fb4933fc9ce18199cb2554dacea8033e7fd3/contrib/minizip/mztools.c#L35-L40

In line 37 it is initialized with fopen. But if program goes into the else branch, it never gets closed.

madler commented 4 weeks ago

All of the files are flushed and closed when the program exits.