aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-12-20 10:03:30 +1030
committerAlan Modra <amodra@gmail.com>2019-12-20 13:36:06 +1030
commit9d78076ef8ef07890ad89c1122bdf49932a979a5 (patch)
tree24cd4c623db252ec7b2d63d3a36eb0faf67dfbc5 /bfd
parentfcc5d04f9264b75241fc50cf655a49c9a7de7d76 (diff)
downloadgdb-9d78076ef8ef07890ad89c1122bdf49932a979a5.zip
gdb-9d78076ef8ef07890ad89c1122bdf49932a979a5.tar.gz
gdb-9d78076ef8ef07890ad89c1122bdf49932a979a5.tar.bz2
bfd_check_format memory leak
* format.c (bfd_check_format_matches): Free matching_vector when not returning matching target strings.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/format.c2
2 files changed, 7 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index c399eac..61d1991 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
2019-12-20 Alan Modra <amodra@gmail.com>
+ * format.c (bfd_check_format_matches): Free matching_vector when
+ not returning matching target strings.
+
+2019-12-20 Alan Modra <amodra@gmail.com>
+
* coff-alpha.c (alpha_ecoff_read_ar_hdr): Free ar_hdr on error return.
2019-12-18 Alan Modra <amodra@gmail.com>
diff --git a/bfd/format.c b/bfd/format.c
index 1d1363d..17b4855 100644
--- a/bfd/format.c
+++ b/bfd/format.c
@@ -513,6 +513,8 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
*(const char **) &matching_vector[match_count] = name;
}
}
+ else if (matching_vector)
+ free (matching_vector);
return FALSE;
}