Use automatic memory clearing and remove the cleanup label.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_monitor_json.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index e4f4dba79a..6cf36d2518 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -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;
-
- ret = virJSONValueObjectStealArray(reply, "return");
+ return NULL;
- cleanup:
- virJSONValueFree(cmd);
- virJSONValueFree(reply);
- return ret;
+ return virJSONValueObjectStealArray(reply, "return");
}
--
2.31.1