mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-18 10:35:20 +00:00
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,
|
||||
virJSONValuePtr *caps)
|
||||
{
|
||||
int ret = -1;
|
||||
virJSONValuePtr cmd = NULL;
|
||||
virJSONValuePtr reply = NULL;
|
||||
g_autoptr(virJSONValue) cmd = NULL;
|
||||
g_autoptr(virJSONValue) reply = NULL;
|
||||
|
||||
cmd = qemuMonitorJSONMakeCommand("migrate-set-capabilities",
|
||||
if (!(cmd = qemuMonitorJSONMakeCommand("migrate-set-capabilities",
|
||||
"a:capabilities", caps,
|
||||
NULL);
|
||||
if (!cmd)
|
||||
goto cleanup;
|
||||
NULL)))
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user