PR26539, memory leak in inflate.c

Like the PR15356 fix for the same leak in bfd, but for readelf.c

	PR 26539
	* readelf.c (uncompress_section_contents): Always call inflateEnd.
This commit is contained in:
Alan Modra 2021-01-15 16:02:52 +10:30
parent 5fda40b28f
commit 3624a6c15c
2 changed files with 8 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2021-01-15 Alan Modra <amodra@gmail.com>
PR 26539
* readelf.c (uncompress_section_contents): Always call inflateEnd.
2021-01-14 Alexandre Oliva <oliva@gnu.org>
* MAINTAINERS: Update my email address.

View File

@ -14221,15 +14221,15 @@ uncompress_section_contents (unsigned char ** buffer,
while (strm.avail_in > 0)
{
if (rc != Z_OK)
goto fail;
break;
strm.next_out = ((Bytef *) uncompressed_buffer
+ (uncompressed_size - strm.avail_out));
rc = inflate (&strm, Z_FINISH);
if (rc != Z_STREAM_END)
goto fail;
break;
rc = inflateReset (& strm);
}
rc = inflateEnd (& strm);
rc |= inflateEnd (& strm);
if (rc != Z_OK
|| strm.avail_out != 0)
goto fail;