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; + return NULL; - ret = virJSONValueObjectStealArray(reply, "return"); - - cleanup: - virJSONValueFree(cmd); - virJSONValueFree(reply); - return ret; + return virJSONValueObjectStealArray(reply, "return"); }