From 2abd91246d3967f62473a9034f5d11f8e8ea8980 Mon Sep 17 00:00:00 2001 Message-Id: <2abd91246d3967f62473a9034f5d11f8e8ea8980@dist-git> From: Jiri Denemark Date: Tue, 26 May 2020 10:59:14 +0200 Subject: [PATCH] cpu_x86: Use g_auto* in virCPUx86Compare MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jiri Denemark Reviewed-by: Ján Tomko (cherry picked from commit bc62d7a49141d745b19d066c07599f228020a0b3) https://bugzilla.redhat.com/show_bug.cgi?id=1840010 Signed-off-by: Jiri Denemark Message-Id: <548eeddbf9eabf5e4a872390189bb0adf746c75f.1590483392.git.jdenemar@redhat.com> Reviewed-by: Ján Tomko --- src/cpu/cpu_x86.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 1a1c846383..c111ff45d4 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1847,32 +1847,30 @@ virCPUx86Compare(virCPUDefPtr host, virCPUDefPtr cpu, bool failIncompatible) { - virCPUCompareResult ret = VIR_CPU_COMPARE_ERROR; - char *message = NULL; + virCPUCompareResult ret; + g_autofree char *message = NULL; if (!host || !host->model) { if (failIncompatible) { virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", _("unknown host CPU")); - } else { - VIR_WARN("unknown host CPU"); - ret = VIR_CPU_COMPARE_INCOMPATIBLE; + return VIR_CPU_COMPARE_ERROR; } - goto cleanup; + + VIR_WARN("unknown host CPU"); + return VIR_CPU_COMPARE_INCOMPATIBLE; } ret = x86Compute(host, cpu, NULL, &message); if (ret == VIR_CPU_COMPARE_INCOMPATIBLE && failIncompatible) { - ret = VIR_CPU_COMPARE_ERROR; if (message) virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", message); else virReportError(VIR_ERR_CPU_INCOMPATIBLE, NULL); + return VIR_CPU_COMPARE_ERROR; } - cleanup: - VIR_FREE(message); return ret; } -- 2.26.2