aboutsummaryrefslogtreecommitdiff
path: root/bfd/peicode.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-08-27 13:19:01 +0930
committerAlan Modra <amodra@gmail.com>2023-08-27 13:57:42 +0930
commit8606b47e94078e77a53f3cd714272c853d2add22 (patch)
treeb823db844fd225ed0889b9bd6849bd5154d40662 /bfd/peicode.h
parent26d0081b52dc482c59abba23ca495304e698ce4b (diff)
downloadgdb-8606b47e94078e77a53f3cd714272c853d2add22.zip
gdb-8606b47e94078e77a53f3cd714272c853d2add22.tar.gz
gdb-8606b47e94078e77a53f3cd714272c853d2add22.tar.bz2
comdat_hash memory leaks
Entries added to the hash table with bfd_malloc ought to be freed when the hash table is deleted. This patch adds the necessary del_f to the htab_create call, and delays creating the table until an IMAGE_SCN_LNK_COMDAT symbol is read. * peicode.h (pe_mkobject): Move comdat_hash creation.. (htab_hash_flags, htab_eq_flags): ..and these support functions.. * coffcode.h (handle_COMDAT): ..to here, renaming support to (comdat_hashf, comdat_eqf): ..this and adding.. (comdat_delf): ..this new function.
Diffstat (limited to 'bfd/peicode.h')
-rw-r--r--bfd/peicode.h17
1 files changed, 0 insertions, 17 deletions
diff --git a/bfd/peicode.h b/bfd/peicode.h
index e1d0660..1ff13b0 100644
--- a/bfd/peicode.h
+++ b/bfd/peicode.h
@@ -255,21 +255,6 @@ coff_swap_scnhdr_in (bfd * abfd, void * ext, void * in)
#endif
}
-static hashval_t
-htab_hash_flags (const void *entry)
-{
- const struct comdat_hash_entry *fe = entry;
- return fe->target_index;
-}
-
-static int
-htab_eq_flags (const void *e1, const void *e2)
-{
- const struct comdat_hash_entry *fe1 = e1;
- const struct comdat_hash_entry *fe2 = e2;
- return fe1->target_index == fe2->target_index;
-}
-
static bool
pe_mkobject (bfd * abfd)
{
@@ -306,8 +291,6 @@ pe_mkobject (bfd * abfd)
pe->dos_message[14] = 0x24;
pe->dos_message[15] = 0x0;
- pe->comdat_hash = htab_create (10, htab_hash_flags, htab_eq_flags, NULL);
-
memset (& pe->pe_opthdr, 0, sizeof pe->pe_opthdr);
bfd_coff_long_section_names (abfd)