qemuMonitorJSONAddDeviceProps(qemuMonitor *mon,
virJSONValue **props)
{
- int ret = -1;
- virJSONValue *cmd = NULL;
- virJSONValue *reply = NULL;
+ g_autoptr(virJSONValue) cmd = NULL;
+ g_autoptr(virJSONValue) reply = NULL;
if (!(cmd = qemuMonitorJSONMakeCommand("device_add", NULL)))
- goto cleanup;
+ return -1;
if (virJSONValueObjectAppend(cmd, "arguments", props) < 0)
- goto cleanup;
+ return -1;
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
- goto cleanup;
+ return -1;
if (qemuMonitorJSONCheckError(cmd, reply) < 0)
- goto cleanup;
+ return -1;
- ret = 0;
- cleanup:
- virJSONValueFree(cmd);
- virJSONValueFree(reply);
- return ret;
+ return 0;
}