72 lines
2.3 KiB
Diff
72 lines
2.3 KiB
Diff
From caedf791f3486b5b3ed1ef54e9c25e7c97b3a39a Mon Sep 17 00:00:00 2001
|
|
Message-Id: <caedf791f3486b5b3ed1ef54e9c25e7c97b3a39a@dist-git>
|
|
From: Jiri Denemark <jdenemar@redhat.com>
|
|
Date: Tue, 26 May 2020 10:59:06 +0200
|
|
Subject: [PATCH] cpu_x86: Use g_auto* in x86DataToCPU
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
(cherry picked from commit 4f2fdad36db2da1aa139470846b3f60f65da8424)
|
|
|
|
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
|
|
|
|
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
Message-Id: <6f88b9d54c70352f9e4aeadd515cd9f4a599545a.1590483392.git.jdenemar@redhat.com>
|
|
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
---
|
|
src/cpu/cpu_x86.c | 20 ++++++--------------
|
|
1 file changed, 6 insertions(+), 14 deletions(-)
|
|
|
|
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
|
index 48f36c2bfc..310dfcbcb3 100644
|
|
--- a/src/cpu/cpu_x86.c
|
|
+++ b/src/cpu/cpu_x86.c
|
|
@@ -771,9 +771,9 @@ x86DataToCPU(const virCPUx86Data *data,
|
|
virCPUx86MapPtr map,
|
|
virDomainCapsCPUModelPtr hvModel)
|
|
{
|
|
- virCPUDefPtr cpu;
|
|
- virCPUx86Data copy = VIR_CPU_X86_DATA_INIT;
|
|
- virCPUx86Data modelData = VIR_CPU_X86_DATA_INIT;
|
|
+ g_autoptr(virCPUDef) cpu = NULL;
|
|
+ g_auto(virCPUx86Data) copy = VIR_CPU_X86_DATA_INIT;
|
|
+ g_auto(virCPUx86Data) modelData = VIR_CPU_X86_DATA_INIT;
|
|
virCPUx86VendorPtr vendor;
|
|
|
|
cpu = virCPUDefNew();
|
|
@@ -801,7 +801,7 @@ x86DataToCPU(const virCPUx86Data *data,
|
|
if ((feature = x86FeatureFind(map, *blocker)) &&
|
|
!x86DataIsSubset(©, &feature->data))
|
|
if (x86DataAdd(&modelData, &feature->data) < 0)
|
|
- goto error;
|
|
+ return NULL;
|
|
}
|
|
}
|
|
|
|
@@ -810,17 +810,9 @@ x86DataToCPU(const virCPUx86Data *data,
|
|
|
|
if (x86DataToCPUFeatures(cpu, VIR_CPU_FEATURE_REQUIRE, ©, map) ||
|
|
x86DataToCPUFeatures(cpu, VIR_CPU_FEATURE_DISABLE, &modelData, map))
|
|
- goto error;
|
|
-
|
|
- cleanup:
|
|
- virCPUx86DataClear(&modelData);
|
|
- virCPUx86DataClear(©);
|
|
- return cpu;
|
|
+ return NULL;
|
|
|
|
- error:
|
|
- virCPUDefFree(cpu);
|
|
- cpu = NULL;
|
|
- goto cleanup;
|
|
+ return g_steal_pointer(&cpu);
|
|
}
|
|
|
|
|
|
--
|
|
2.26.2
|
|
|