*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / dsrec.c
index 54f29717360783f28fae8dd3a969199f5025adbf..66d4c13bfcf6736581f31d2e94f08fabe3860b74 100644 (file)
@@ -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_unref (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);
 }
 
 /*
This page took 0.034938 seconds and 4 git commands to generate.