- identifier = NULL;
- status = parse_string (&buffer, &identifier);
- if (status != 0)
- {
- print_to_socket (fh, "-1 Cannot parse identifier.\n");
- return (-1);
+ /* parse_identifier() modifies its first argument,
+ * returning pointers into it */
+ identifier_copy = sstrdup(argv[0]);
+
+ status = parse_identifier(
+ argv[0], &ret_getval->identifier.host, &ret_getval->identifier.plugin,
+ &ret_getval->identifier.plugin_instance, &ret_getval->identifier.type,
+ &ret_getval->identifier.type_instance, opts->identifier_default_host);
+ if (status != 0) {
+ DEBUG("cmd_parse_getval: Cannot parse identifier `%s'.", identifier_copy);
+ cmd_error(CMD_PARSE_ERROR, err, "Cannot parse identifier `%s'.",
+ identifier_copy);
+ sfree(identifier_copy);
+ return CMD_PARSE_ERROR;