elflink.c memory leaks
Alan Modra
amodra@gmail.com
Mon Jan 20 07:49:52 GMT 2025
old_strtab can still leak.
* elflink.c (elf_link_add_object_symbols): Free old_strtab
in another code path. Revert one unnecessary change in last
patch.
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 8974015728d..27b02dd404f 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -5807,6 +5807,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
return true;
}
+ free (old_strtab);
+ old_strtab = NULL;
if (old_tab != NULL)
{
if (!(*bed->notice_as_needed) (abfd, info, notice_needed))
@@ -6030,7 +6032,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
if (bed->check_directives
&& !(*bed->check_directives) (abfd, info))
- goto error_free_vers;
+ goto error_return;
/* If this is a non-traditional link, try to optimize the handling
of the .stab/.stabstr sections. */
--
Alan Modra
More information about the Binutils
mailing list