diff options
author | Alan Modra <amodra@gmail.com> | 2021-01-15 16:02:52 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2021-01-15 16:26:55 +1030 |
commit | 3624a6c15ce48e03d43983ec11d586d97ca08728 (patch) | |
tree | 5760831728fad041ea2d121efbe1d6e92c571cb4 | |
parent | 5fda40b28fb6ed86d76af1af68f61f3c016d3a26 (diff) | |
download | gdb-3624a6c15ce48e03d43983ec11d586d97ca08728.zip gdb-3624a6c15ce48e03d43983ec11d586d97ca08728.tar.gz gdb-3624a6c15ce48e03d43983ec11d586d97ca08728.tar.bz2 |
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.
-rw-r--r-- | binutils/ChangeLog | 5 | ||||
-rw-r--r-- | binutils/readelf.c | 6 |
2 files changed, 8 insertions, 3 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index f099429..0e3ae10 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -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. diff --git a/binutils/readelf.c b/binutils/readelf.c index ad16b45..d828d56 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -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; |