提交 c74b898d 编写于 作者: P Peter Krempa

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

Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 e90d51c4
......@@ -4280,9 +4280,8 @@ qemuMonitorJSONDriveMirror(qemuMonitorPtr mon,
bool shallow,
bool reuse)
{
int ret = -1;
virJSONValuePtr cmd;
virJSONValuePtr reply = NULL;
VIR_AUTOPTR(virJSONValue) cmd = NULL;
VIR_AUTOPTR(virJSONValue) reply = NULL;
cmd = qemuMonitorJSONMakeCommand("drive-mirror",
"s:device", device,
......@@ -4298,16 +4297,9 @@ qemuMonitorJSONDriveMirror(qemuMonitorPtr mon,
return -1;
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
goto cleanup;
if (qemuMonitorJSONCheckError(cmd, reply) < 0)
goto cleanup;
return -1;
ret = 0;
cleanup:
virJSONValueFree(cmd);
virJSONValueFree(reply);
return ret;
return qemuMonitorJSONCheckError(cmd, reply);
}
......@@ -4321,9 +4313,8 @@ qemuMonitorJSONBlockdevMirror(qemuMonitorPtr mon,
unsigned long long buf_size,
bool shallow)
{
int ret = -1;
virJSONValuePtr cmd;
virJSONValuePtr reply = NULL;
VIR_AUTOPTR(virJSONValue) cmd = NULL;
VIR_AUTOPTR(virJSONValue) reply = NULL;
cmd = qemuMonitorJSONMakeCommand("blockdev-mirror",
"S:job-id", jobname,
......@@ -4337,14 +4328,10 @@ qemuMonitorJSONBlockdevMirror(qemuMonitorPtr mon,
if (!cmd)
return -1;
if ((ret = qemuMonitorJSONCommand(mon, cmd, &reply)) < 0)
goto cleanup;
ret = qemuMonitorJSONCheckError(cmd, reply);
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
return -1;
cleanup:
virJSONValueFree(cmd);
virJSONValueFree(reply);
return ret;
return qemuMonitorJSONCheckError(cmd, reply);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册