From b55ec8b676ed05d93ee49d6c79ae0403616c4fb0 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 9 Oct 2017 13:21:44 +1030 Subject: [PATCH] PR22212, memory leak in nm PR 22212 * dwarf2.c (_bfd_dwarf2_cleanup_debug_info): Free funcinfo_hash_table and varinfo_hash_table. --- bfd/ChangeLog | 6 ++++++ bfd/dwarf2.c | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 4cb07152937..c334e53307b 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2017-10-09 Alan Modra + + PR 22212 + * dwarf2.c (_bfd_dwarf2_cleanup_debug_info): Free + funcinfo_hash_table and varinfo_hash_table. + 2017-10-08 H.J. Lu * elf32-sh.c (readonly_dynrelocs): Dump dynamic relocation diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index 248e621ad33..ef380dd6823 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -4927,6 +4927,10 @@ _bfd_dwarf2_cleanup_debug_info (bfd *abfd, void **pinfo) } } + if (stash->funcinfo_hash_table) + bfd_hash_table_free (&stash->funcinfo_hash_table->base); + if (stash->varinfo_hash_table) + bfd_hash_table_free (&stash->varinfo_hash_table->base); if (stash->dwarf_abbrev_buffer) free (stash->dwarf_abbrev_buffer); if (stash->dwarf_line_buffer) -- 2.30.2