aboutsummaryrefslogtreecommitdiff
path: root/libctf
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2024-06-12 12:28:45 +0100
committerNick Alcock <nick.alcock@oracle.com>2024-06-18 13:20:32 +0100
commite3cd5660756223bbe4a2ab607ef019bbf5e9daf9 (patch)
tree484100f38a2d8f7dbaa18760261bd9f10e51e557 /libctf
parent327356780ab4436b59b666a756323b8bda68cbd4 (diff)
downloadbinutils-e3cd5660756223bbe4a2ab607ef019bbf5e9daf9.zip
binutils-e3cd5660756223bbe4a2ab607ef019bbf5e9daf9.tar.gz
binutils-e3cd5660756223bbe4a2ab607ef019bbf5e9daf9.tar.bz2
libctf: fix dict leak on archive-wide symbol lookup error path
If a lookup fails for a reason unrelated to a lack of type data for this symbol, we return with an error; but we fail to close the dict we opened most recently, which is leaked. libctf/ * ctf-archive.c (ctf_arc_lookup_sym_or_name): Close dict.
Diffstat (limited to 'libctf')
-rw-r--r--libctf/ctf-archive.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libctf/ctf-archive.c b/libctf/ctf-archive.c
index f459c02..4744cb7 100644
--- a/libctf/ctf-archive.c
+++ b/libctf/ctf-archive.c
@@ -957,6 +957,7 @@ ctf_arc_lookup_sym_or_name (ctf_archive_t *wrapper, unsigned long symidx,
{
if (errp)
*errp = ctf_errno (fp);
+ ctf_dict_close (fp);
ctf_next_destroy (i);
return NULL; /* errno is set for us. */
}