char *actual;
char buffer[MD_MAX_NONSTRING_CHARS]; /* For non-string types. */
char *temp;
+ int type;
if ((md == NULL) || (key == NULL) || (value == NULL))
return (-EINVAL);
return (-ENOENT);
}
- switch (e->type)
+ type = e->type;
+
+ switch (type)
{
case MD_TYPE_STRING:
actual = e->value.mv_string;
break;
default:
pthread_mutex_unlock (&md->lock);
- ERROR ("meta_data_as_string: unknown type %d for key `%s'",
- e->type, e->key);
+ ERROR ("meta_data_as_string: unknown type %d for key `%s'", type, key);
return (-ENOENT);
}
+ pthread_mutex_unlock (&md->lock);
+
temp = md_strdup (actual);
if (temp == NULL)
{
pthread_mutex_unlock (&md->lock);
- ERROR ("meta_data_as_string: md_strdup failed for key `%s'.", e->key);
+ ERROR ("meta_data_as_string: md_strdup failed for key `%s'.", key);
return (-ENOMEM);
}
- pthread_mutex_unlock (&md->lock);
-
*value = temp;
return (0);
if (l == NULL)
return;
- free (l->key);
+ sfree (l->key);
if (l->next != NULL)
ts_key_list_free (l->next);
- free (l);
+ sfree (l);
} /* }}} void ts_name_list_free */
struct ts_data_s
}
if (cf_util_get_string (ci, &entry->key) != 0)
+ {
+ ts_key_list_free (entry);
return (-1); /* An error has already been reported. */
+ }
if (strlen (entry->key) == 0)
{
ERROR ("Target `set': The `%s' option does not accept empty string as "
"first argument.", ci->key);
- sfree (entry->key);
+ ts_key_list_free (entry);
return (-1);
}