* section.c (bfd_make_section_anyway): Release newsect ptr when
authorAlan Modra <amodra@gmail.com>
Tue, 10 Oct 2000 15:23:38 +0000 (15:23 +0000)
committerAlan Modra <amodra@gmail.com>
Tue, 10 Oct 2000 15:23:38 +0000 (15:23 +0000)
newsect->symbol fails to alloc.  Use bfd_release instead of free.

bfd/ChangeLog
bfd/section.c

index 249a4bf..5ab46c3 100644 (file)
@@ -1,3 +1,8 @@
+2000-10-10  Tom Rix <trix@redhat.com>
+
+       * section.c (bfd_make_section_anyway): Release newsect ptr when 
+       newsect->symbol fails to alloc.  Use bfd_release instead of free.
+
 2000-10-09  Richard Henderson  <rth@cygnus.com
 
        * elf64-ia64.c (elf64_ia64_unwind_entry_compare_bfd): New.
index 4c858f6..fc64b20 100644 (file)
@@ -795,7 +795,10 @@ bfd_make_section_anyway (abfd, name)
      section.  */
   newsect->symbol = bfd_make_empty_symbol (abfd);
   if (newsect->symbol == NULL)
-    return NULL;
+    {
+      bfd_release (abfd, newsect);
+      return NULL;
+    }
   newsect->symbol->name = name;
   newsect->symbol->value = 0;
   newsect->symbol->section = newsect;
@@ -805,7 +808,7 @@ bfd_make_section_anyway (abfd, name)
 
   if (BFD_SEND (abfd, _new_section_hook, (abfd, newsect)) != true)
     {
-      free (newsect);
+      bfd_release (abfd, newsect);
       return NULL;
     }