aboutsummaryrefslogtreecommitdiff
path: root/gdb/elfread.c
diff options
context:
space:
mode:
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 de61a9a..608a868 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);
}
}