libvirt/SOURCES/libvirt-cpu_x86-Use-g_auto-...

47 lines
1.4 KiB
Diff

From b91ae8a08c0906011e9ff2ed4f8c8fce908603b5 Mon Sep 17 00:00:00 2001
Message-Id: <b91ae8a08c0906011e9ff2ed4f8c8fce908603b5@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Tue, 26 May 2020 10:59:16 +0200
Subject: [PATCH] cpu_x86: Use g_auto* in x86EncodePolicy
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 5b45d2cf1ff0d2d972f103a678c01bc0eb7c1e18)
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <cf057cf29d8f8f2369eab3afb5202a6466c0dc2e.1590483392.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/cpu/cpu_x86.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index dba4165527..fd410aeafb 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -2164,7 +2164,7 @@ x86EncodePolicy(virCPUx86Data *data,
virCPUx86MapPtr map,
virCPUFeaturePolicy policy)
{
- virCPUx86ModelPtr model;
+ g_autoptr(virCPUx86Model) model = NULL;
if (!(model = x86ModelFromCPU(cpu, map, policy)))
return -1;
@@ -2172,7 +2172,6 @@ x86EncodePolicy(virCPUx86Data *data,
*data = model->data;
model->data.len = 0;
model->data.items = NULL;
- x86ModelFree(model);
return 0;
}
--
2.26.2