summaryrefslogtreecommitdiff
path: root/gdb/symfile-mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/symfile-mem.c')
-rw-r--r--gdb/symfile-mem.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c
index ad87abdf75d..2e53be05de4 100644
--- a/gdb/symfile-mem.c
+++ b/gdb/symfile-mem.c
@@ -111,15 +111,14 @@ symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr, char *name,
xfree (name);
}
+ cleanup = make_cleanup_bfd_unref (nbfd);
+
if (!bfd_check_format (nbfd, bfd_object))
- {
- make_cleanup_bfd_unref (nbfd);
- error (_("Got object file from memory but can't read symbols: %s."),
- bfd_errmsg (bfd_get_error ()));
- }
+ error (_("Got object file from memory but can't read symbols: %s."),
+ bfd_errmsg (bfd_get_error ()));
sai = alloc_section_addr_info (bfd_count_sections (nbfd));
- cleanup = make_cleanup (xfree, sai);
+ make_cleanup (xfree, sai);
i = 0;
for (sec = nbfd->sections; sec != NULL; sec = sec->next)
if ((bfd_get_section_flags (nbfd, sec) & (SEC_ALLOC|SEC_LOAD)) != 0)