libctf: allow ctf_type_lname of a null pointer.
[deliverable/binutils-gdb.git] / libctf / ctf-types.c
index 6e6776223438c5c3ee99260274317d1e6183b58e..ec221d734948e12faac78af46abd71c68dfb167e 100644 (file)
@@ -438,11 +438,12 @@ ssize_t
 ctf_type_lname (ctf_file_t *fp, ctf_id_t type, char *buf, size_t len)
 {
   char *str = ctf_type_aname (fp, type);
-  size_t slen = strlen (str);
+  size_t slen;
 
   if (str == NULL)
     return CTF_ERR;             /* errno is set for us */
 
+  slen = strlen (str);
   snprintf (buf, len, "%s", str);
   free (str);
 
This page took 0.02693 seconds and 4 git commands to generate.