qemuMonitorJSONQueryBlockstats: Refactor cleanup

Use automatic memory clearing and remove the cleanup label.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Peter Krempa 2021-10-19 15:05:21 +02:00
parent d7050b0d08
commit 4e950ba4b4

View File

@ -2520,25 +2520,19 @@ qemuMonitorJSONGetOneBlockStatsInfo(virJSONValue *dev,
virJSONValue *
qemuMonitorJSONQueryBlockstats(qemuMonitor *mon)
{
virJSONValue *cmd;
virJSONValue *reply = NULL;
virJSONValue *ret = NULL;
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
if (!(cmd = qemuMonitorJSONMakeCommand("query-blockstats", NULL)))
return NULL;
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
goto cleanup;
return NULL;
if (qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_ARRAY) < 0)
goto cleanup;
return NULL;
ret = virJSONValueObjectStealArray(reply, "return");
cleanup:
virJSONValueFree(cmd);
virJSONValueFree(reply);
return ret;
return virJSONValueObjectStealArray(reply, "return");
}