libctf: avoid potential double free
authorAlan Modra <amodra@gmail.com>
Thu, 8 Dec 2022 01:15:12 +0000 (11:45 +1030)
committerAlan Modra <amodra@gmail.com>
Thu, 8 Dec 2022 01:16:22 +0000 (11:46 +1030)
* ctf-link.c (ctf_link_add_cu_mapping): Set t NULL after free.

libctf/ctf-link.c

index 702f2b4d5feac154ebba5998c6de600b2a4e6506..902b4408cd66197059cda7a91193317f6502b970 100644 (file)
@@ -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)
     {