From: Peter Krempa Date: Tue, 19 Oct 2021 13:05:21 +0000 (+0200) Subject: qemuMonitorJSONQueryBlockstats: Refactor cleanup X-Git-Tag: v7.9.0-rc1~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e950ba4b4d675d5b43c625771a1985cc125bc36;p=thirdparty%2Flibvirt.git qemuMonitorJSONQueryBlockstats: Refactor cleanup Use automatic memory clearing and remove the cleanup label. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- 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"); }