From: Tim Wiederhake Date: Mon, 5 Jul 2021 14:17:55 +0000 (+0200) Subject: qemuMonitorJSONGetAllBlockJobInfo: Remove superfluous `goto`s X-Git-Tag: v7.6.0-rc1~147 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7db3db301c182583a02b528758a580eb7943fd1d;p=thirdparty%2Flibvirt.git qemuMonitorJSONGetAllBlockJobInfo: Remove superfluous `goto`s Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa --- diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 59c5eedb0a..7e53e0ce84 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -5074,39 +5074,34 @@ qemuMonitorJSONGetAllBlockJobInfo(qemuMonitor *mon, virJSONValue *data; size_t nr_results; size_t i; - g_autoptr(GHashTable) blockJobs = NULL; + g_autoptr(GHashTable) blockJobs = virHashNew(g_free); cmd = qemuMonitorJSONMakeCommand("query-block-jobs", NULL); if (!cmd) return NULL; if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) - goto cleanup; + return NULL; if ((data = virJSONValueObjectGetArray(reply, "return")) == NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("reply was missing return data")); - goto cleanup; + return NULL; } nr_results = virJSONValueArraySize(data); - blockJobs = virHashNew(g_free); for (i = 0; i < nr_results; i++) { virJSONValue *entry = virJSONValueArrayGet(data, i); if (!entry) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing array element")); - goto error; + return NULL; } if (qemuMonitorJSONParseBlockJobInfo(blockJobs, entry, rawjobname) < 0) - goto error; + return NULL; } - cleanup: return g_steal_pointer(&blockJobs); - - error: - return NULL; }