aboutsummaryrefslogtreecommitdiff
path: root/gdb/dsrec.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-07-18 19:38:39 +0000
committerTom Tromey <tromey@redhat.com>2012-07-18 19:38:39 +0000
commitd6ad71ba41afb220549d1c7fe61edd6bddd128ad (patch)
treebd5c076fbabda8c8d31b3ec64689f40213168276 /gdb/dsrec.c
parenta4453b7e0b9b84dd18c844ef43fbb9f6e2e75433 (diff)
downloadgdb-d6ad71ba41afb220549d1c7fe61edd6bddd128ad.zip
gdb-d6ad71ba41afb220549d1c7fe61edd6bddd128ad.tar.gz
gdb-d6ad71ba41afb220549d1c7fe61edd6bddd128ad.tar.bz2
* remote-mips.c (mips_load_srec): Use make_cleanup_bfd_close.
(pmon_load_fast): Likewise. * m32r-rom.c (m32r_load): Use make_cleanup_bfd_close. (m32r_upload_command): Likewise. * dsrec.c (load_srec): Use make_cleanup_bfd_close. * solib-darwin.c (darwin_solib_get_all_image_info_addr_at_init): Use make_cleanup_bfd_close.
Diffstat (limited to 'gdb/dsrec.c')
-rw-r--r--gdb/dsrec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/dsrec.c b/gdb/dsrec.c
index 54f2971..8eefe1e 100644
--- a/gdb/dsrec.c
+++ b/gdb/dsrec.c
@@ -57,6 +57,7 @@ load_srec (struct serial *desc, const char *file, bfd_vma load_offset,
int reclen;
time_t start_time, end_time;
unsigned long data_count = 0;
+ struct cleanup *cleanup;
srec = (char *) alloca (maxrecsize + 1);
@@ -67,9 +68,11 @@ load_srec (struct serial *desc, const char *file, bfd_vma load_offset,
return;
}
+ cleanup = make_cleanup_bfd_close (abfd);
if (bfd_check_format (abfd, bfd_object) == 0)
{
printf_filtered (_("File is not an object file\n"));
+ do_cleanups (cleanup);
return;
}
@@ -171,6 +174,7 @@ load_srec (struct serial *desc, const char *file, bfd_vma load_offset,
serial_flush_input (desc);
report_transfer_performance (data_count, start_time, end_time);
+ do_cleanups (cleanup);
}
/*