bfd_check_format memory leak

Alan Modra amodra@gmail.com
Fri Dec 20 09:53:00 GMT 2019


	* format.c (bfd_check_format_matches): Free matching_vector when
	not returning matching target strings.

diff --git a/bfd/format.c b/bfd/format.c
index 1d1363d184..17b48556a9 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;
 }
 

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list