summaryrefslogtreecommitdiff
path: root/bfd/section.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2000-10-10 15:23:38 +0000
committerAlan Modra <amodra@bigpond.net.au>2000-10-10 15:23:38 +0000
commit5ef0e6ab3f1f1952eb7dcdf1150506b54355af63 (patch)
tree1010fbe1508a42db5a36519a86685b4d7c8f6e03 /bfd/section.c
parent36f668e606d58d0a058192303cb70251420b0565 (diff)
downloadbinutils-redhat-5ef0e6ab3f1f1952eb7dcdf1150506b54355af63.tar.gz
* 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/section.c')
-rw-r--r--bfd/section.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/bfd/section.c b/bfd/section.c
index 4c858f686d..fc64b2019f 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;
}