aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-07-23 14:58:44 +0000
committerTom Tromey <tromey@redhat.com>2012-07-23 14:58:44 +0000
commit8ac244b433d5d36b787afd36f7144069e7d837e0 (patch)
treedccbc64cbec657281a84c4d8e07d96df3e508661 /gdb/elfread.c
parent * cli/cli-dump.c (bfd_openr_with_cleanup): Use gdb_bfd_openr. (diff)
downloadbinutils-gdb-8ac244b433d5d36b787afd36f7144069e7d837e0.tar.gz
binutils-gdb-8ac244b433d5d36b787afd36f7144069e7d837e0.tar.bz2
binutils-gdb-8ac244b433d5d36b787afd36f7144069e7d837e0.zip
* coffread.c (coff_symfile_read): Make a cleanup for 'debugfile'
and 'abfd'. * elfread.c (elf_symfile_read): Make a cleanup for 'debugfile' and 'abfd'. * jit.c (jit_bfd_try_read_symtab): Make a cleanup for 'nbfd'. * machoread.c (macho_add_oso_symfile): Make a cleanup for 'abfd'. (macho_symfile_read): Make a cleanup for 'dsym_bfd'. * objfiles.c (allocate_objfile): Acquire a new reference. * rs6000-nat.c (add_vmap): Don't acquire a BFD reference. * solib.c (solib_read_symbols): Don't acquire a BFD reference. * spu-linux-nat.c (spu_symbol_file_add_from_memory): Make a cleanup for 'nbfd'. * symfile-mem.c (symbol_file_add_from_memory): Make a cleanup for 'nbfd'. * symfile.c (symbol_file_add_with_addrs_or_offsets): Don't make a cleanup for 'abfd'. (symbol_file_add): Make a BFD cleanup.
Diffstat (limited to 'gdb/elfread.c')
-rw-r--r--gdb/elfread.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gdb/elfread.c b/gdb/elfread.c
index de61a9aa586..608a8682d83 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -1445,10 +1445,12 @@ elf_symfile_read (struct objfile *objfile, int symfile_flags)
if (debugfile)
{
+ struct cleanup *cleanup = make_cleanup (xfree, debugfile);
bfd *abfd = symfile_bfd_open (debugfile);
+ make_cleanup_bfd_unref (abfd);
symbol_file_add_separate (abfd, symfile_flags, objfile);
- xfree (debugfile);
+ do_cleanups (cleanup);
}
}