aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-03-04 11:27:29 +1030
committerAlan Modra <amodra@gmail.com>2020-03-04 11:40:01 +1030
commit1039fd9ac2a57b7634f60a66ea51e64f5ff69251 (patch)
tree374f6e38472df058a1c07ce98530a2d92ef021d4
parenteef64366e1e9052b121a0c235c49be362aa2fe65 (diff)
downloadgdb-1039fd9ac2a57b7634f60a66ea51e64f5ff69251.zip
gdb-1039fd9ac2a57b7634f60a66ea51e64f5ff69251.tar.gz
gdb-1039fd9ac2a57b7634f60a66ea51e64f5ff69251.tar.bz2
Call cleanup on bfd_check_format_matches error exit
* format.c (bfd_check_format_matches): Call cleanup on error exit.
-rw-r--r--bfd/ChangeLog4
-rw-r--r--bfd/format.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ff2881f..6ed228d 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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.
diff --git a/bfd/format.c b/bfd/format.c
index 61f26c6..ab98486 100644
--- a/bfd/format.c
+++ b/bfd/format.c
@@ -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);