|
|
a41c76 |
From db7c7611aa3f80aca75e557795a12354f6fde82c Mon Sep 17 00:00:00 2001
|
|
|
a41c76 |
Message-Id: <db7c7611aa3f80aca75e557795a12354f6fde82c@dist-git>
|
|
|
a41c76 |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
a41c76 |
Date: Tue, 26 May 2020 10:59:09 +0200
|
|
|
a41c76 |
Subject: [PATCH] cpu_x86: Use g_auto* in x86ModelFromCPU
|
|
|
a41c76 |
MIME-Version: 1.0
|
|
|
a41c76 |
Content-Type: text/plain; charset=UTF-8
|
|
|
a41c76 |
Content-Transfer-Encoding: 8bit
|
|
|
a41c76 |
|
|
|
a41c76 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
a41c76 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
a41c76 |
(cherry picked from commit 93f173adbecee92f9973745a2aca65a27c4aa8a6)
|
|
|
a41c76 |
|
|
|
a41c76 |
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
|
|
|
a41c76 |
|
|
|
a41c76 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
a41c76 |
Message-Id: <f205d9dfe07f4009faaeb702cf6be1726306747b.1590483392.git.jdenemar@redhat.com>
|
|
|
a41c76 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
a41c76 |
---
|
|
|
a41c76 |
src/cpu/cpu_x86.c | 14 +++++---------
|
|
|
a41c76 |
1 file changed, 5 insertions(+), 9 deletions(-)
|
|
|
a41c76 |
|
|
|
a41c76 |
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
|
|
a41c76 |
index 10c5fbacf7..5215405755 100644
|
|
|
a41c76 |
--- a/src/cpu/cpu_x86.c
|
|
|
a41c76 |
+++ b/src/cpu/cpu_x86.c
|
|
|
a41c76 |
@@ -1173,7 +1173,7 @@ x86ModelFromCPU(const virCPUDef *cpu,
|
|
|
a41c76 |
virCPUx86MapPtr map,
|
|
|
a41c76 |
int policy)
|
|
|
a41c76 |
{
|
|
|
a41c76 |
- virCPUx86ModelPtr model = NULL;
|
|
|
a41c76 |
+ g_autoptr(virCPUx86Model) model = NULL;
|
|
|
a41c76 |
size_t i;
|
|
|
a41c76 |
|
|
|
a41c76 |
/* host CPU only contains required features; requesting other features
|
|
|
a41c76 |
@@ -1216,7 +1216,7 @@ x86ModelFromCPU(const virCPUDef *cpu,
|
|
|
a41c76 |
if (!(feature = x86FeatureFind(map, cpu->features[i].name))) {
|
|
|
a41c76 |
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
a41c76 |
_("Unknown CPU feature %s"), cpu->features[i].name);
|
|
|
a41c76 |
- goto error;
|
|
|
a41c76 |
+ return NULL;
|
|
|
a41c76 |
}
|
|
|
a41c76 |
|
|
|
a41c76 |
if (policy == -1) {
|
|
|
a41c76 |
@@ -1224,7 +1224,7 @@ x86ModelFromCPU(const virCPUDef *cpu,
|
|
|
a41c76 |
case VIR_CPU_FEATURE_FORCE:
|
|
|
a41c76 |
case VIR_CPU_FEATURE_REQUIRE:
|
|
|
a41c76 |
if (x86DataAdd(&model->data, &feature->data) < 0)
|
|
|
a41c76 |
- goto error;
|
|
|
a41c76 |
+ return NULL;
|
|
|
a41c76 |
break;
|
|
|
a41c76 |
|
|
|
a41c76 |
case VIR_CPU_FEATURE_DISABLE:
|
|
|
a41c76 |
@@ -1238,15 +1238,11 @@ x86ModelFromCPU(const virCPUDef *cpu,
|
|
|
a41c76 |
break;
|
|
|
a41c76 |
}
|
|
|
a41c76 |
} else if (x86DataAdd(&model->data, &feature->data) < 0) {
|
|
|
a41c76 |
- goto error;
|
|
|
a41c76 |
+ return NULL;
|
|
|
a41c76 |
}
|
|
|
a41c76 |
}
|
|
|
a41c76 |
|
|
|
a41c76 |
- return model;
|
|
|
a41c76 |
-
|
|
|
a41c76 |
- error:
|
|
|
a41c76 |
- x86ModelFree(model);
|
|
|
a41c76 |
- return NULL;
|
|
|
a41c76 |
+ return g_steal_pointer(&model);
|
|
|
a41c76 |
}
|
|
|
a41c76 |
|
|
|
a41c76 |
|
|
|
a41c76 |
--
|
|
|
a41c76 |
2.26.2
|
|
|
a41c76 |
|