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