aboutsummaryrefslogtreecommitdiff
path: root/binutils/readelf.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-03-24 12:12:24 +1030
committerAlan Modra <amodra@gmail.com>2020-03-24 13:19:14 +1030
commit5a814d6d96bc6426ae1fa8b0d1561ad081deb159 (patch)
tree453be4781ddb2f28c1ca13f2f830379dcf3e596c /binutils/readelf.c
parent1ce0847daa8de001ed4a1b32341fcc3ce53f5a30 (diff)
downloadgdb-5a814d6d96bc6426ae1fa8b0d1561ad081deb159.zip
gdb-5a814d6d96bc6426ae1fa8b0d1561ad081deb159.tar.gz
gdb-5a814d6d96bc6426ae1fa8b0d1561ad081deb159.tar.bz2
readelf memory leak in process_mips_specific
* readelf.c (process_mips_specific): Free iconf on error path.
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r--binutils/readelf.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 61f0617..1f0f492 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]);