qemuMonitorJSONSetMigrationCapabilities: Refactor cleanup
Use automatic memory freeing and remove the 'cleanup' label and 'ret' variable. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
d430b5ab31
commit
681006a14b
@ -6974,27 +6974,21 @@ int
|
|||||||
qemuMonitorJSONSetMigrationCapabilities(qemuMonitorPtr mon,
|
qemuMonitorJSONSetMigrationCapabilities(qemuMonitorPtr mon,
|
||||||
virJSONValuePtr *caps)
|
virJSONValuePtr *caps)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
g_autoptr(virJSONValue) cmd = NULL;
|
||||||
virJSONValuePtr cmd = NULL;
|
g_autoptr(virJSONValue) reply = NULL;
|
||||||
virJSONValuePtr reply = NULL;
|
|
||||||
|
|
||||||
cmd = qemuMonitorJSONMakeCommand("migrate-set-capabilities",
|
if (!(cmd = qemuMonitorJSONMakeCommand("migrate-set-capabilities",
|
||||||
"a:capabilities", caps,
|
"a:capabilities", caps,
|
||||||
NULL);
|
NULL)))
|
||||||
if (!cmd)
|
return -1;
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (qemuMonitorJSONCheckError(cmd, reply) < 0)
|
if (qemuMonitorJSONCheckError(cmd, reply) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
cleanup:
|
|
||||||
virJSONValueFree(cmd);
|
|
||||||
virJSONValueFree(reply);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user