]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
elflink.c memory leaks
authorAlan Modra <amodra@gmail.com>
Sat, 11 Jan 2025 05:22:58 +0000 (15:52 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 15 Jan 2025 12:07:16 +0000 (22:37 +1030)
commit8c0361c7bb74911244364c7ee13db97275ea1c8d
treeb202f7d6cfb7814078c18513157b6b86bc1ffec4
parent525e2ebb8946de9aa630910efa8bb633eceea2d7
elflink.c memory leaks

Many targets leaked parts of the elf_link_hash_table.  Fix that by
making _bfd_elf_link_hash_table_init set up hash_table_free correctly,
so that targets that extend elf_link_hash_table without adding
anything that needs freeing, will use _bfd_elf_link_hash_table_free.

* elflink.c (elf_link_add_object_symbols): Always free
nondeflt_vers.  Don't return false without freeing.
(_bfd_elf_link_hash_table_init): Set hash_table_free here..
(_bfd_elf_link_hash_table_create): ..rather than here.
(elf_link_swap_symbols_out): Don't free strtab here..
(elf_link_add_object_symbols): ..do so here instead.  Don't
omit freeing on some error return paths.
bfd/elflink.c