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.
This commit is contained in:
Alan Modra 2023-09-13 11:38:33 +01:00 committed by Nick Clifton
parent bc92a20a84
commit 452855278a
2 changed files with 6 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2023-09-13 Alan Modra <amodra@gmail.com>
* 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 <tom@tromey.com>
PR binutils/30703

View File

@ -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;
}