]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - libctf/ctf-create.c
libctf: do not corrupt strings across ctf_serialize
[thirdparty/binutils-gdb.git] / libctf / ctf-create.c
index 6acc2428cd79e475634c75931d734f08e55e4c4e..ea2c1481b6c7e37ab104efe43e1ab45c50d1b178 100644 (file)
@@ -439,7 +439,8 @@ ctf_add_generic (ctf_dict_t *fp, uint32_t flag, const char *name, int kind,
   type = ++fp->ctf_typemax;
   type = LCTF_INDEX_TO_TYPE (fp, type, (fp->ctf_flags & LCTF_CHILD));
 
-  dtd->dtd_data.ctt_name = ctf_str_add_ref (fp, name, &dtd->dtd_data.ctt_name);
+  dtd->dtd_data.ctt_name = ctf_str_add_pending (fp, name,
+                                               &dtd->dtd_data.ctt_name);
   dtd->dtd_type = type;
 
   if (dtd->dtd_data.ctt_name == 0 && name != NULL && name[0] != '\0')