public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] libctf: avoid potential double free
@ 2022-12-08  1:23 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2022-12-08  1:23 UTC (permalink / raw)
  To: bfd-cvs, gdb-cvs

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

commit 57336e2e4d05eaac6367400e6ce3aed24f838f2c
Author: Alan Modra <amodra@gmail.com>
Date:   Thu Dec 8 11:45:12 2022 +1030

    libctf: avoid potential double free
    
            * ctf-link.c (ctf_link_add_cu_mapping): Set t NULL after free.

Diff:
---
 libctf/ctf-link.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libctf/ctf-link.c b/libctf/ctf-link.c
index 702f2b4d5fe..902b4408cd6 100644
--- a/libctf/ctf-link.c
+++ b/libctf/ctf-link.c
@@ -431,7 +431,10 @@ ctf_link_add_cu_mapping (ctf_dict_t *fp, const char *from, const char *to)
 	}
     }
   else
-    free (t);
+    {
+      free (t);
+      t = NULL;
+    }
 
   if (ctf_dynhash_insert (one_out, f, NULL) < 0)
     {

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-08  1:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-08  1:23 [binutils-gdb] libctf: avoid potential double free Alan Modra

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).