[binutils-gdb] libctf: avoid potential double free
Alan Modra
amodra@sourceware.org
Thu Dec 8 01:23:24 GMT 2022
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)
{
More information about the Binutils-cvs
mailing list