mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-26 06:25:19 +00:00
qemuMonitorJSONBlockdevAdd: Refactor cleanup
Use automatic variable freeing and get rid of the cleanup section. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
37f01262ee
commit
643294110c
@ -8823,25 +8823,19 @@ int
|
|||||||
qemuMonitorJSONBlockdevAdd(qemuMonitorPtr mon,
|
qemuMonitorJSONBlockdevAdd(qemuMonitorPtr mon,
|
||||||
virJSONValuePtr props)
|
virJSONValuePtr props)
|
||||||
{
|
{
|
||||||
virJSONValuePtr cmd;
|
g_autoptr(virJSONValue) cmd = NULL;
|
||||||
virJSONValuePtr reply = NULL;
|
g_autoptr(virJSONValue) reply = NULL;
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
if (!(cmd = qemuMonitorJSONMakeCommandInternal("blockdev-add", props)))
|
if (!(cmd = qemuMonitorJSONMakeCommandInternal("blockdev-add", props)))
|
||||||
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)
|
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