[PATCH v2] libelf: {de,}compress: ensure zlib resource cleanup
Mark Wielaard
mark@klomp.org
Fri Mar 20 17:10:06 GMT 2020
Hi Matthias,
On Fri, 2020-03-20 at 12:17 +0100, Matthias Maennich via Elfutils-devel wrote:
> __libelf_decompress would only cleanup zlib resources via inflateEnd()
> in case inflating was successful, but would leak memory if not. Fix this
> by calling inflateEnd() unconditionally.
>
> __libelf_decompress did this all the time already, but called
> deflateEnd() twice. That is not a (known) issue, but can be cleaned up
> by ensuring all error paths use 'return deflate_cleanup' and the success
> path calls deflateEnd() only once. Note, the deflate() needs to return
> Z_STREAM_END to indicate we are done. Hence change the condition.
It was that last condition I had missed.
Added a ChangeLog entry and pushed to master.
Thanks,
Mark
More information about the Elfutils-devel
mailing list