readelf memory leak in process_mips_specific
authorAlan Modra <amodra@gmail.com>
Tue, 24 Mar 2020 01:42:24 +0000 (12:12 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 24 Mar 2020 02:49:14 +0000 (13:19 +1030)
* readelf.c (process_mips_specific): Free iconf on error path.

binutils/ChangeLog
binutils/readelf.c

index bad19ea8b296440ebb30e4ffdc1b7f0d24b37210..11be80dfc3067ba9b9f48aa7b8b0dcb259b6a159 100644 (file)
@@ -1,3 +1,7 @@
+2020-03-24  Alan Modra  <amodra@gmail.com>
+
+       * readelf.c (process_mips_specific): Free iconf on error path.
+
 2020-03-23  Nick Clifton  <nickc@redhat.com>
 
        PR 25714
index 61f06176835db28e7c089ae90a40bb40401dc0fb..1f0f49222fd47b9e4d204a9f7c5ae08a3a8e259d 100644 (file)
@@ -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]);