[binutils-gdb] bfd_check_format memory leak
Alan Modra
amodra@sourceware.org
Fri Dec 20 09:57:00 GMT 2019
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9d78076ef8ef07890ad89c1122bdf49932a979a5
commit 9d78076ef8ef07890ad89c1122bdf49932a979a5
Author: Alan Modra <amodra@gmail.com>
Date: Fri Dec 20 10:03:30 2019 +1030
bfd_check_format memory leak
* format.c (bfd_check_format_matches): Free matching_vector when
not returning matching target strings.
Diff:
---
bfd/ChangeLog | 5 +++++
bfd/format.c | 2 ++
2 files changed, 7 insertions(+)
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;
}
More information about the Binutils-cvs
mailing list