1
0

qemu: monitor: Use VIR_AUTOPTR in qemuMonitorJSON(Drive/Blockdev)Mirror

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2019-05-17 18:17:26 +02:00
parent e90d51c4d0
commit c74b898d4c

View File

@ -4280,9 +4280,8 @@ qemuMonitorJSONDriveMirror(qemuMonitorPtr mon,
bool shallow, bool shallow,
bool reuse) bool reuse)
{ {
int ret = -1; VIR_AUTOPTR(virJSONValue) cmd = NULL;
virJSONValuePtr cmd; VIR_AUTOPTR(virJSONValue) reply = NULL;
virJSONValuePtr reply = NULL;
cmd = qemuMonitorJSONMakeCommand("drive-mirror", cmd = qemuMonitorJSONMakeCommand("drive-mirror",
"s:device", device, "s:device", device,
@ -4298,16 +4297,9 @@ qemuMonitorJSONDriveMirror(qemuMonitorPtr mon,
return -1; return -1;
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
goto cleanup; return -1;
if (qemuMonitorJSONCheckError(cmd, reply) < 0) return qemuMonitorJSONCheckError(cmd, reply);
goto cleanup;
ret = 0;
cleanup:
virJSONValueFree(cmd);
virJSONValueFree(reply);
return ret;
} }
@ -4321,9 +4313,8 @@ qemuMonitorJSONBlockdevMirror(qemuMonitorPtr mon,
unsigned long long buf_size, unsigned long long buf_size,
bool shallow) bool shallow)
{ {
int ret = -1; VIR_AUTOPTR(virJSONValue) cmd = NULL;
virJSONValuePtr cmd; VIR_AUTOPTR(virJSONValue) reply = NULL;
virJSONValuePtr reply = NULL;
cmd = qemuMonitorJSONMakeCommand("blockdev-mirror", cmd = qemuMonitorJSONMakeCommand("blockdev-mirror",
"S:job-id", jobname, "S:job-id", jobname,
@ -4337,14 +4328,10 @@ qemuMonitorJSONBlockdevMirror(qemuMonitorPtr mon,
if (!cmd) if (!cmd)
return -1; return -1;
if ((ret = qemuMonitorJSONCommand(mon, cmd, &reply)) < 0) if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
goto cleanup; return -1;
ret = qemuMonitorJSONCheckError(cmd, reply);
cleanup: return qemuMonitorJSONCheckError(cmd, reply);
virJSONValueFree(cmd);
virJSONValueFree(reply);
return ret;
} }