Call cleanup on bfd_check_format_matches error exit
authorAlan Modra <amodra@gmail.com>
Wed, 4 Mar 2020 00:57:29 +0000 (11:27 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 4 Mar 2020 01:10:01 +0000 (11:40 +1030)
* format.c (bfd_check_format_matches): Call cleanup on error exit.

bfd/ChangeLog
bfd/format.c

index ff2881f966fe4444ed4febd3f543ddad75220203..6ed228d713b05e1da9b1455a31a03c3785dffb14 100644 (file)
@@ -1,3 +1,7 @@
+2020-03-04  Alan Modra  <amodra@gmail.com>
+
+       * format.c (bfd_check_format_matches): Call cleanup on error exit.
+
 2020-03-03  Alan Modra  <amodra@gmail.com>
 
        * format.c (struct bfd_preserve): Add cleanup field.
index 61f26c6042ae3b3f957951c793cae12d1b1e3811..ab98486fb4526919ffbaeddc3d1c76d331ff3606 100644 (file)
@@ -515,6 +515,8 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
     err_unrecog:
       bfd_set_error (bfd_error_file_not_recognized);
     err_ret:
+      if (cleanup)
+       cleanup (abfd);
       abfd->xvec = save_targ;
       abfd->format = bfd_unknown;
       if (matching_vector)
@@ -544,6 +546,8 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
     }
   else if (matching_vector)
     free (matching_vector);
+  if (cleanup)
+    cleanup (abfd);
   if (preserve_match.marker != NULL)
     bfd_preserve_finish (abfd, &preserve_match);
   bfd_preserve_restore (abfd, &preserve);
This page took 0.026853 seconds and 4 git commands to generate.