]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
libctf: fix dict leak on archive-wide symbol lookup error path
authorNick Alcock <nick.alcock@oracle.com>
Wed, 12 Jun 2024 11:28:45 +0000 (12:28 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Tue, 18 Jun 2024 12:20:32 +0000 (13:20 +0100)
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.

libctf/ctf-archive.c

index f459c02e702fc4195eb8e3ace1aeb6aa5799c014..4744cb7a8280fa989b9ac5bc94ee920fe5673897 100644 (file)
@@ -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.  */
        }