diff --git a/src/daemon/meta_data.c b/src/daemon/meta_data.c
index d26570e9db7f3e855f347b4303441041a912ba15..a11fccb2e2fb125b02ffc9d8d048ad58f3388972 100644 (file)
--- a/src/daemon/meta_data.c
+++ b/src/daemon/meta_data.c
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);