Always free matching vector from bfd_check_format_matches

At least one place calling list_matching_formats failed to free the
"matching" vector from bfd_check_format_matches afterwards.  Fix that
by calling free inside list_matching_formats.

binutils/
	* bucomm.c (list_matching_formats): Free arg.
	* addr2line.c (process_file): Adjust to suit.
	* ar.c (open_inarch, ranlib_touch): Likewise.
	* coffdump.c (main): Likewise.
	* nm.c (display_archive, display_file): Likewise.
	* objcopy.c (copy_file): Likewise.
	* objdump.c (display_object_bfd): Likewise.
	* size.c (display_bfd): Likewise.
	* srconv.c (main): Likewise.
ld/
	* ldlang.c (load_symbols): Free "matching".
This commit is contained in:
Alan Modra
2022-06-16 14:48:13 +09:30
parent 8ad7c8be4b
commit 370426d0da
10 changed files with 21 additions and 49 deletions

View File

@@ -1828,10 +1828,7 @@ main (int ac, char **av)
bfd_nonfatal (input_file);
if (bfd_get_error () == bfd_error_file_ambiguously_recognized)
{
list_matching_formats (matching);
free (matching);
}
list_matching_formats (matching);
exit (1);
}