From 5a814d6d96bc6426ae1fa8b0d1561ad081deb159 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 24 Mar 2020 12:12:24 +1030 Subject: [PATCH] readelf memory leak in process_mips_specific * readelf.c (process_mips_specific): Free iconf on error path. --- binutils/ChangeLog | 4 ++++ binutils/readelf.c | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index bad19ea8b29..11be80dfc30 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,7 @@ +2020-03-24 Alan Modra + + * readelf.c (process_mips_specific): Free iconf on error path. + 2020-03-23 Nick Clifton PR 25714 diff --git a/binutils/readelf.c b/binutils/readelf.c index 61f06176835..1f0f49222fd 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -17074,7 +17074,10 @@ process_mips_specific (Filedata * filedata) get_data (NULL, filedata, conflicts_offset, sizeof (*econf32), conflictsno, _("conflict")); if (!econf32) - return FALSE; + { + free (iconf); + return FALSE; + } for (cnt = 0; cnt < conflictsno; ++cnt) iconf[cnt] = BYTE_GET (econf32[cnt]); @@ -17089,7 +17092,10 @@ process_mips_specific (Filedata * filedata) get_data (NULL, filedata, conflicts_offset, sizeof (*econf64), conflictsno, _("conflict")); if (!econf64) - return FALSE; + { + free (iconf); + return FALSE; + } for (cnt = 0; cnt < conflictsno; ++cnt) iconf[cnt] = BYTE_GET (econf64[cnt]); -- 2.30.2