aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2000-10-10 15:23:38 +0000
committerAlan Modra <amodra@gmail.com>2000-10-10 15:23:38 +0000
commit4d7ce4dd486816139276a2c5cf90e0213fb47b21 (patch)
treedf10a1534ae2e9b13335ba2e460c94e3ed03b753 /bfd
parent120abad8b7c1433b48d5d1c8fb43b19b20feccd9 (diff)
downloadgdb-4d7ce4dd486816139276a2c5cf90e0213fb47b21.zip
gdb-4d7ce4dd486816139276a2c5cf90e0213fb47b21.tar.gz
gdb-4d7ce4dd486816139276a2c5cf90e0213fb47b21.tar.bz2
* section.c (bfd_make_section_anyway): Release newsect ptr when
newsect->symbol fails to alloc. Use bfd_release instead of free.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/section.c7
2 files changed, 10 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 249a4bf..5ab46c3 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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.
diff --git a/bfd/section.c b/bfd/section.c
index 4c858f6..fc64b20 100644
--- a/bfd/section.c
+++ b/bfd/section.c
@@ -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;
}