aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2025-01-20 11:33:49 +1030
committerAlan Modra <amodra@gmail.com>2025-01-20 18:16:15 +1030
commitc785932bb5ae8f8b9e8857c6436e13f051710858 (patch)
tree2c3e5da41ad7f6dff60a004e034460fa01707440
parent130bb6bbbdd4c32be067a0c9c2524b669bf6ae04 (diff)
downloadbinutils-c785932bb5ae8f8b9e8857c6436e13f051710858.zip
binutils-c785932bb5ae8f8b9e8857c6436e13f051710858.tar.gz
binutils-c785932bb5ae8f8b9e8857c6436e13f051710858.tar.bz2
Re: elflink.c memory leaks
* elflink.c (elf_link_add_object_symbols): Free old_strtab in another code path. Revert one unnecessary change in last patch.
-rw-r--r--bfd/elflink.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 8974015..27b02dd 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. */