Multi-target: NEWS and user manual
[deliverable/binutils-gdb.git] / bfd / elfcode.h
index 5180f79a74dfea8aab803e6c9d70429c146bedab..e1e89cf78f2da34186d08670423a9211e3a8a834 100644 (file)
@@ -1,5 +1,5 @@
 /* ELF executable support for BFD.
-   Copyright (C) 1991-2019 Free Software Foundation, Inc.
+   Copyright (C) 1991-2020 Free Software Foundation, Inc.
 
    Written by Fred Fish @ Cygnus Support, from information published
    in "UNIX System V Release 4, Programmers Guide: ANSI C and
@@ -749,11 +749,7 @@ elf_object_p (bfd *abfd)
                  != 0))
            abfd->flags &= ~D_PAGED;
        }
-    }
 
-  /* A further sanity check.  */
-  if (i_ehdrp->e_shnum != 0)
-    {
       if (i_ehdrp->e_shstrndx >= elf_numsections (abfd)
          || i_shdrp[i_ehdrp->e_shstrndx].sh_type != SHT_STRTAB)
        {
@@ -1656,6 +1652,7 @@ NAME(_bfd_elf,bfd_from_remote_memory)
   bfd_vma high_offset;
   bfd_vma shdr_end;
   bfd_vma loadbase;
+  char *filename;
 
   /* Read in the ELF header in external format.  */
   err = target_read_memory (ehdr_vma, (bfd_byte *) &x_ehdr, sizeof x_ehdr);
@@ -1863,14 +1860,22 @@ NAME(_bfd_elf,bfd_from_remote_memory)
       free (contents);
       return NULL;
     }
+  filename = bfd_strdup ("<in-memory>");
+  if (filename == NULL)
+    {
+      free (bim);
+      free (contents);
+      return NULL;
+    }
   nbfd = _bfd_new_bfd ();
   if (nbfd == NULL)
     {
+      free (filename);
       free (bim);
       free (contents);
       return NULL;
     }
-  nbfd->filename = xstrdup ("<in-memory>");
+  nbfd->filename = filename;
   nbfd->xvec = templ->xvec;
   bim->size = high_offset;
   bim->buffer = contents;
This page took 0.040106 seconds and 4 git commands to generate.