From: Alan Modra Date: Thu, 19 Dec 2019 23:33:30 +0000 (+1030) Subject: bfd_check_format memory leak X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9d78076ef8ef07890ad89c1122bdf49932a979a5;p=binutils-gdb.git bfd_check_format memory leak * format.c (bfd_check_format_matches): Free matching_vector when not returning matching target strings. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index c399eac35ac..61d19911599 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2019-12-20 Alan Modra + + * format.c (bfd_check_format_matches): Free matching_vector when + not returning matching target strings. + 2019-12-20 Alan Modra * coff-alpha.c (alpha_ecoff_read_ar_hdr): Free ar_hdr on error return. diff --git a/bfd/format.c b/bfd/format.c index 1d1363d1840..17b48556a9a 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; }