aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-03-29 22:31:15 +1030
committerAlan Modra <amodra@gmail.com>2023-03-30 15:18:02 +1030
commitea7672c10e0b762c02fd40ce94d490b56bc14675 (patch)
treea0a5df4f73e69223d1b8e6b569b09dcdae091561 /bfd/section.c
parentTidy leaked objcopy memory (diff)
downloadbinutils-gdb-ea7672c10e0b762c02fd40ce94d490b56bc14675.tar.gz
binutils-gdb-ea7672c10e0b762c02fd40ce94d490b56bc14675.tar.bz2
binutils-gdb-ea7672c10e0b762c02fd40ce94d490b56bc14675.zip
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.
Diffstat (limited to 'bfd/section.c')
-rw-r--r--bfd/section.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/bfd/section.c b/bfd/section.c
index 3b1993b60a5..1e7e8ac7522 100644
--- a/bfd/section.c
+++ b/bfd/section.c
@@ -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