+ if (result != CMD_OK)
+ cmd_destroy_putval(ret_putval);
+
+ return result;
+} /* cmd_status_t cmd_parse_putval */
+
+void cmd_destroy_putval(cmd_putval_t *putval) {
+ if (putval == NULL)
+ return;
+
+ sfree(putval->raw_identifier);
+
+ for (size_t i = 0; i < putval->vl_num; ++i) {
+ sfree(putval->vl[i].values);
+ meta_data_destroy(putval->vl[i].meta);
+ putval->vl[i].meta = NULL;
+ }
+ sfree(putval->vl);
+ putval->vl = NULL;
+ putval->vl_num = 0;
+} /* void cmd_destroy_putval */
+
+cmd_status_t cmd_handle_putval(FILE *fh, char *buffer) {
+ cmd_error_handler_t err = {cmd_error_fh, fh};
+ cmd_t cmd;
+
+ int status;
+
+ DEBUG("utils_cmd_putval: cmd_handle_putval (fh = %p, buffer = %s);",
+ (void *)fh, buffer);
+
+ if ((status = cmd_parse(buffer, &cmd, NULL, &err)) != CMD_OK)
+ return status;
+ if (cmd.type != CMD_PUTVAL) {
+ cmd_error(CMD_UNKNOWN_COMMAND, &err, "Unexpected command: `%s'.",
+ CMD_TO_STRING(cmd.type));
+ cmd_destroy(&cmd);
+ return CMD_UNKNOWN_COMMAND;
+ }
+
+ for (size_t i = 0; i < cmd.cmd.putval.vl_num; ++i)
+ plugin_dispatch_values(&cmd.cmd.putval.vl[i]);
+