]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - binutils/readelf.c
gdb/testsuite: Move helper function into lib/dwarf.exp
[thirdparty/binutils-gdb.git] / binutils / readelf.c
index 61f06176835db28e7c089ae90a40bb40401dc0fb..eb41e10dae939656d68cfbb64361eb7049be28bd 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]);
@@ -20455,7 +20461,6 @@ process_archive (Filedata * filedata, bfd_boolean is_thin_archive)
 
          close_file (member_filedata);
          free (member_file_name);
-         free (qualified_name);
        }
       else if (is_thin_archive)
        {
@@ -20499,11 +20504,13 @@ process_archive (Filedata * filedata, bfd_boolean is_thin_archive)
        {
          free (name);
          archive_file_offset = arch.next_arhdr_offset;
-         arch.next_arhdr_offset += archive_file_size;
-
          filedata->file_name = qualified_name;
          if (! process_object (filedata))
            ret = FALSE;
+         arch.next_arhdr_offset += archive_file_size;
+         /* Stop looping with "negative" archive_file_size.  */
+         if (arch.next_arhdr_offset < archive_file_size)
+           arch.next_arhdr_offset = -1ul;
        }
 
       free (qualified_name);