* [binutils-gdb] Fix: "Possible Memory leak in bed hash.c"
@ 2023-09-13 10:39 Nick Clifton
0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2023-09-13 10:39 UTC (permalink / raw)
To: bfd-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=452855278aa4789c5a7b87767e55de2c5a9938cf
commit 452855278aa4789c5a7b87767e55de2c5a9938cf
Author: Alan Modra <amodra@gmail.com>
Date: Wed Sep 13 11:38:33 2023 +0100
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:
---
bfd/ChangeLog | 5 +++++
bfd/elf-strtab.c | 1 +
2 files changed, 6 insertions(+)
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 <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
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;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-09-13 10:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-13 10:39 [binutils-gdb] Fix: "Possible Memory leak in bed hash.c" Nick Clifton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).