Fix memory leaks
[deliverable/binutils-gdb.git] / bfd / format.c
index 9af6efcbab5c12cf477d41ffbf9bd7d85bba77a4..655ccd9f08ff1e9b6fa62883583168d99a42fbe3 100644 (file)
@@ -163,7 +163,11 @@ bfd_check_format_matches (abfd, format, matching)
   if (!abfd->target_defaulted)
     {
       if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)        /* rewind! */
-       return FALSE;
+       {
+         if (matching)
+           free ((PTR) matching_vector);
+         return FALSE;
+       }
 
       right_targ = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
 
@@ -214,7 +218,11 @@ bfd_check_format_matches (abfd, format, matching)
       abfd->xvec = *target;    /* Change BFD's target temporarily.  */
 
       if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
-       return FALSE;
+       {
+         if (matching)
+           free ((PTR) matching_vector);
+         return FALSE;
+       }
 
       /* If _bfd_check_format neglects to set bfd_error, assume
         bfd_error_wrong_format.  We didn't used to even pay any
This page took 0.023412 seconds and 4 git commands to generate.