Set dwarf2 stash pointer earlier
authorAlan Modra <amodra@gmail.com>
Sun, 8 Jan 2023 02:26:21 +0000 (12:56 +1030)
committerAlan Modra <amodra@gmail.com>
Mon, 9 Jan 2023 23:39:11 +0000 (10:09 +1030)
commit8eacd95dd4406ae4021a6996c0c505648da75440
tree4a3e07d38921686be6f11f0e678c40504172e589
parent10c386190cb8dcc398292b6053d5fbf6bfd3a4ff
Set dwarf2 stash pointer earlier

This fixes a memory leak in the vanishingly rare cases (found by
fuzzers of course) when something goes wrong in the save_section_vma,
htab_create_alloc or alloc_trie_leaf calls before *pinfo is written.
If *pinfo is not written, _bfd_dwarf2_cleanup_debug_info won't be able
to free that memory.

* dwarf2.c (_bfd_dwarf2_slurp_debug_info): Save stash pointer
on setting up stash.
bfd/dwarf2.c