mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 23:37:42 +00:00
qemu: monitor: Refactor variable cleanup in qemuMonitorJSONQueryNamedBlockNodes
Use g_autoptr to get rid of the cleanup section. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
b7991c903c
commit
f886c9f330
@ -8742,26 +8742,19 @@ qemuMonitorJSONSetBlockThreshold(qemuMonitorPtr mon,
|
|||||||
virJSONValuePtr
|
virJSONValuePtr
|
||||||
qemuMonitorJSONQueryNamedBlockNodes(qemuMonitorPtr mon)
|
qemuMonitorJSONQueryNamedBlockNodes(qemuMonitorPtr mon)
|
||||||
{
|
{
|
||||||
virJSONValuePtr cmd;
|
g_autoptr(virJSONValue) cmd = NULL;
|
||||||
virJSONValuePtr reply = NULL;
|
g_autoptr(virJSONValue) reply = NULL;
|
||||||
virJSONValuePtr ret = NULL;
|
|
||||||
|
|
||||||
if (!(cmd = qemuMonitorJSONMakeCommand("query-named-block-nodes", NULL)))
|
if (!(cmd = qemuMonitorJSONMakeCommand("query-named-block-nodes", NULL)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
if (qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_ARRAY) < 0)
|
if (qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_ARRAY) < 0)
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
ret = virJSONValueObjectStealArray(reply, "return");
|
return virJSONValueObjectStealArray(reply, "return");
|
||||||
|
|
||||||
cleanup:
|
|
||||||
virJSONValueFree(cmd);
|
|
||||||
virJSONValueFree(reply);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user