Fix memory leak in bfd_get_debug_link_info_1

* opncls.c (bfd_get_alt_debug_link_info): Don't bother freeing
	after bfd_malloc_and_get_section failure.
	(get_build_id): Likewise.
	(bfd_get_debug_link_info_1): Likewise.  Free section contents
	when crc not present.
	* section.c (bfd_malloc_and_get_section): Document that the
	buffer is NULL on error return.
This commit is contained in:
Alan Modra
2023-03-29 22:31:15 +10:30
parent 45fec14c02
commit ea7672c10e
2 changed files with 9 additions and 13 deletions

View File

@@ -1600,6 +1600,8 @@ SYNOPSIS
DESCRIPTION
Read all data from @var{section} in BFD @var{abfd}
into a buffer, *@var{buf}, malloc'd by this function.
Return @code{true} on success, @code{false} on failure in which
case *@var{buf} will be NULL.
*/
bool