From: Alan Modra Date: Wed, 13 Sep 2023 10:38:33 +0000 (+0100) Subject: Fix: "Possible Memory leak in bed hash.c" X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=452855278aa4789c5a7b87767e55de2c5a9938cf;p=binutils-gdb.git Fix: "Possible Memory leak in bed hash.c" * elf-strtab.c (_bfd_elf_strtab_init): In the event of memory allocation failure, make sure that the hash table is freed. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 8b478cbedcb..20dd6ba9e8e 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2023-09-13 Alan Modra + + * elf-strtab.c (_bfd_elf_strtab_init): In the event of memory + allocation failure, make sure that the hash table is freed. + 2023-08-30 Tom Tromey PR binutils/30703 diff --git a/bfd/elf-strtab.c b/bfd/elf-strtab.c index 5de5af73bb4..d52a3079f4c 100644 --- a/bfd/elf-strtab.c +++ b/bfd/elf-strtab.c @@ -116,6 +116,7 @@ _bfd_elf_strtab_init (void) bfd_malloc (table->alloced * amt)); if (table->array == NULL) { + bfd_hash_table_free (&table->table); free (table); return NULL; }