]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
section_by_target_index memory leak
authorAlan Modra <amodra@gmail.com>
Tue, 30 May 2023 10:35:38 +0000 (20:05 +0930)
committerAlan Modra <amodra@gmail.com>
Thu, 1 Jun 2023 00:21:59 +0000 (09:51 +0930)
commit90fd5049bde965ad217a013398ffc722f298de82
tree79a60f6bc8d4cc6598fda31a3f2063262aba8a54
parentd18f60c747c220ef8ca118b61e5db5c5cdf8f28b
section_by_target_index memory leak

The rs6000 backend can call coff_section_from_bfd_index from its
object_p function via coff_set_alignment_hook.  If the object doesn't
match, or another target matches too, then the hash table needs to be
freed via a cleanup.

* coffgen.c (coff_object_cleanup): New function.
(coff_real_object_p): Return coff_object_cleanup, and call on
failure path.  Move declaration to..
* libcoff-in.h: ..here.
(coff_object_cleanup): Declare.
* coff-stgo32.c (go32exe_cleanup): Call coff_object_cleanup.
(go32exe_check_format): Adjust assertion.
* libcoff.h: Regenerate.
bfd/coff-stgo32.c
bfd/coffgen.c
bfd/libcoff-in.h
bfd/libcoff.h