aboutsummaryrefslogtreecommitdiff
path: root/libctf
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2023-12-13 12:24:57 +0000
committerNick Alcock <nick.alcock@oracle.com>2024-04-19 16:14:45 +0100
commitca019227843f62f5ac0a1c432680e3ca05c4377b (patch)
treebaa22fb65fbf29e47a93738b12d94c842ff7b9db /libctf
parent6364617120e3886b79e0ba89f2c1506766ed4e98 (diff)
downloadbinutils-ca019227843f62f5ac0a1c432680e3ca05c4377b.zip
binutils-ca019227843f62f5ac0a1c432680e3ca05c4377b.tar.gz
binutils-ca019227843f62f5ac0a1c432680e3ca05c4377b.tar.bz2
libctf: don't leak the symbol name in the name->type cache
This cache replaced a cache of symbol index->ctf_id_t. That cache was just an array, so it could get away with just being free()d, but the ctfi_symnamedicts cache that replaced it is a full dynhash with a dynamically-allocated string as the key. As such, it needs freeing with ctf_dynhash_destroy(), not just free(), or we leak parts of the underlying hashtab, and all the keys. libctf/ChangeLog: * ctf-archive.c (ctf_arc_flush_caches): Fix leak.
Diffstat (limited to 'libctf')
-rw-r--r--libctf/ctf-archive.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libctf/ctf-archive.c b/libctf/ctf-archive.c
index a0ea838..a88c613 100644
--- a/libctf/ctf-archive.c
+++ b/libctf/ctf-archive.c
@@ -699,7 +699,7 @@ void
ctf_arc_flush_caches (ctf_archive_t *wrapper)
{
free (wrapper->ctfi_symdicts);
- free (wrapper->ctfi_symnamedicts);
+ ctf_dynhash_destroy (wrapper->ctfi_symnamedicts);
ctf_dynhash_destroy (wrapper->ctfi_dicts);
wrapper->ctfi_symdicts = NULL;
wrapper->ctfi_symnamedicts = NULL;