|
|
b971b8 |
From 9810efd43b52070c20fe41b41175b0afff6710aa Mon Sep 17 00:00:00 2001
|
|
|
b971b8 |
Message-Id: <9810efd43b52070c20fe41b41175b0afff6710aa@dist-git>
|
|
|
b971b8 |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
b971b8 |
Date: Tue, 26 May 2020 10:59:02 +0200
|
|
|
b971b8 |
Subject: [PATCH] cpu_x86: Use glib allocation for virCPUx86Feature
|
|
|
b971b8 |
MIME-Version: 1.0
|
|
|
b971b8 |
Content-Type: text/plain; charset=UTF-8
|
|
|
b971b8 |
Content-Transfer-Encoding: 8bit
|
|
|
b971b8 |
|
|
|
b971b8 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
b971b8 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
b971b8 |
(cherry picked from commit 51b6e9c1000151cc515804134a00ccb0d7b3e44a)
|
|
|
b971b8 |
|
|
|
b971b8 |
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
|
|
|
b971b8 |
|
|
|
b971b8 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
b971b8 |
Message-Id: <4c4090765c01f7359c521cb09d247b1694afbe9c.1590483392.git.jdenemar@redhat.com>
|
|
|
b971b8 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
b971b8 |
---
|
|
|
b971b8 |
src/cpu/cpu_x86.c | 22 ++++------------------
|
|
|
b971b8 |
1 file changed, 4 insertions(+), 18 deletions(-)
|
|
|
b971b8 |
|
|
|
b971b8 |
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
|
|
b971b8 |
index aa66309b21..3a598e35d2 100644
|
|
|
b971b8 |
--- a/src/cpu/cpu_x86.c
|
|
|
b971b8 |
+++ b/src/cpu/cpu_x86.c
|
|
|
b971b8 |
@@ -893,28 +893,17 @@ x86VendorParse(xmlXPathContextPtr ctxt,
|
|
|
b971b8 |
}
|
|
|
b971b8 |
|
|
|
b971b8 |
|
|
|
b971b8 |
-static virCPUx86FeaturePtr
|
|
|
b971b8 |
-x86FeatureNew(void)
|
|
|
b971b8 |
-{
|
|
|
b971b8 |
- virCPUx86FeaturePtr feature;
|
|
|
b971b8 |
-
|
|
|
b971b8 |
- if (VIR_ALLOC(feature) < 0)
|
|
|
b971b8 |
- return NULL;
|
|
|
b971b8 |
-
|
|
|
b971b8 |
- return feature;
|
|
|
b971b8 |
-}
|
|
|
b971b8 |
-
|
|
|
b971b8 |
-
|
|
|
b971b8 |
static void
|
|
|
b971b8 |
x86FeatureFree(virCPUx86FeaturePtr feature)
|
|
|
b971b8 |
{
|
|
|
b971b8 |
if (!feature)
|
|
|
b971b8 |
return;
|
|
|
b971b8 |
|
|
|
b971b8 |
- VIR_FREE(feature->name);
|
|
|
b971b8 |
+ g_free(feature->name);
|
|
|
b971b8 |
virCPUx86DataClear(&feature->data);
|
|
|
b971b8 |
- VIR_FREE(feature);
|
|
|
b971b8 |
+ g_free(feature);
|
|
|
b971b8 |
}
|
|
|
b971b8 |
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Feature, x86FeatureFree);
|
|
|
b971b8 |
|
|
|
b971b8 |
|
|
|
b971b8 |
static int
|
|
|
b971b8 |
@@ -1056,11 +1045,8 @@ x86FeatureParse(xmlXPathContextPtr ctxt,
|
|
|
b971b8 |
char *str = NULL;
|
|
|
b971b8 |
int ret = -1;
|
|
|
b971b8 |
|
|
|
b971b8 |
- if (!(feature = x86FeatureNew()))
|
|
|
b971b8 |
- goto cleanup;
|
|
|
b971b8 |
-
|
|
|
b971b8 |
+ feature = g_new0(virCPUx86Feature, 1);
|
|
|
b971b8 |
feature->migratable = true;
|
|
|
b971b8 |
-
|
|
|
b971b8 |
feature->name = g_strdup(name);
|
|
|
b971b8 |
|
|
|
b971b8 |
if (x86FeatureFind(map, feature->name)) {
|
|
|
b971b8 |
--
|
|
|
b971b8 |
2.26.2
|
|
|
b971b8 |
|