qemuMonitorJSONBlockJobCancel(qemuMonitor *mon,
const char *jobname)
{
- int ret = -1;
- virJSONValue *cmd = NULL;
- virJSONValue *reply = NULL;
+ g_autoptr(virJSONValue) cmd = NULL;
+ g_autoptr(virJSONValue) reply = NULL;
if (!(cmd = qemuMonitorJSONMakeCommand("block-job-cancel",
"s:device", jobname,
return -1;
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
- goto cleanup;
+ return -1;
if (qemuMonitorJSONBlockJobError(cmd, reply, jobname) < 0)
- goto cleanup;
-
- ret = 0;
+ return -1;
- cleanup:
- virJSONValueFree(cmd);
- virJSONValueFree(reply);
- return ret;
+ return 0;
}