public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
From: Nick Alcock <nix@sourceware.org>
To: binutils-cvs@sourceware.org
Subject: [binutils-gdb] libctf: fix dict leak on archive-wide symbol lookup error path
Date: Tue, 18 Jun 2024 12:55:36 +0000 (GMT)	[thread overview]
Message-ID: <20240618125536.54B253882AD7@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e3cd5660756223bbe4a2ab607ef019bbf5e9daf9

commit e3cd5660756223bbe4a2ab607ef019bbf5e9daf9
Author: Nick Alcock <nick.alcock@oracle.com>
Date:   Wed Jun 12 12:28:45 2024 +0100

    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.

Diff:
---
 libctf/ctf-archive.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libctf/ctf-archive.c b/libctf/ctf-archive.c
index f459c02e702..4744cb7a828 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.  */
 	}

                 reply	other threads:[~2024-06-18 12:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240618125536.54B253882AD7@sourceware.org \
    --to=nix@sourceware.org \
    --cc=binutils-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).