render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
6d3351
From 393675b4e08f2ff8a685d9bd02a83079d32e6eee Mon Sep 17 00:00:00 2001
6d3351
Message-Id: <393675b4e08f2ff8a685d9bd02a83079d32e6eee@dist-git>
6d3351
From: Jiri Denemark <jdenemar@redhat.com>
6d3351
Date: Fri, 7 Apr 2017 17:43:59 +0200
6d3351
Subject: [PATCH] qemu: Introduce virQEMUCapsHostCPUDataClear
6d3351
6d3351
To keep freeing of host CPU data in one place.
6d3351
6d3351
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6d3351
(cherry picked from commit b0605e848724c5dc478382398b734398abff674c)
6d3351
6d3351
https://bugzilla.redhat.com/show_bug.cgi?id=1444421
6d3351
6d3351
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6d3351
---
6d3351
 src/qemu/qemu_capabilities.c | 30 +++++++++++++++++-------------
6d3351
 1 file changed, 17 insertions(+), 13 deletions(-)
6d3351
6d3351
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
6d3351
index 98a9a0f1d..8e7cbb590 100644
6d3351
--- a/src/qemu/qemu_capabilities.c
6d3351
+++ b/src/qemu/qemu_capabilities.c
6d3351
@@ -2112,6 +2112,21 @@ virQEMUCapsHostCPUDataCopy(virQEMUCapsPtr dst,
6d3351
 }
6d3351
 
6d3351
 
6d3351
+static void
6d3351
+virQEMUCapsHostCPUDataClear(virQEMUCapsPtr qemuCaps)
6d3351
+{
6d3351
+    qemuMonitorCPUModelInfoFree(qemuCaps->kvmCPUModelInfo);
6d3351
+    qemuMonitorCPUModelInfoFree(qemuCaps->tcgCPUModelInfo);
6d3351
+    qemuCaps->kvmCPUModelInfo = NULL;
6d3351
+    qemuCaps->tcgCPUModelInfo = NULL;
6d3351
+
6d3351
+    virCPUDefFree(qemuCaps->kvmCPUModel);
6d3351
+    virCPUDefFree(qemuCaps->tcgCPUModel);
6d3351
+    qemuCaps->kvmCPUModel = NULL;
6d3351
+    qemuCaps->tcgCPUModel = NULL;
6d3351
+}
6d3351
+
6d3351
+
6d3351
 virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps)
6d3351
 {
6d3351
     virQEMUCapsPtr ret = virQEMUCapsNew();
6d3351
@@ -2198,10 +2213,7 @@ void virQEMUCapsDispose(void *obj)
6d3351
 
6d3351
     VIR_FREE(qemuCaps->gicCapabilities);
6d3351
 
6d3351
-    qemuMonitorCPUModelInfoFree(qemuCaps->kvmCPUModelInfo);
6d3351
-    qemuMonitorCPUModelInfoFree(qemuCaps->tcgCPUModelInfo);
6d3351
-    virCPUDefFree(qemuCaps->kvmCPUModel);
6d3351
-    virCPUDefFree(qemuCaps->tcgCPUModel);
6d3351
+    virQEMUCapsHostCPUDataClear(qemuCaps);
6d3351
 }
6d3351
 
6d3351
 void
6d3351
@@ -4074,15 +4086,7 @@ virQEMUCapsReset(virQEMUCapsPtr qemuCaps)
6d3351
     VIR_FREE(qemuCaps->gicCapabilities);
6d3351
     qemuCaps->ngicCapabilities = 0;
6d3351
 
6d3351
-    qemuMonitorCPUModelInfoFree(qemuCaps->kvmCPUModelInfo);
6d3351
-    qemuMonitorCPUModelInfoFree(qemuCaps->tcgCPUModelInfo);
6d3351
-    qemuCaps->kvmCPUModelInfo = NULL;
6d3351
-    qemuCaps->tcgCPUModelInfo = NULL;
6d3351
-
6d3351
-    virCPUDefFree(qemuCaps->kvmCPUModel);
6d3351
-    virCPUDefFree(qemuCaps->tcgCPUModel);
6d3351
-    qemuCaps->kvmCPUModel = NULL;
6d3351
-    qemuCaps->tcgCPUModel = NULL;
6d3351
+    virQEMUCapsHostCPUDataClear(qemuCaps);
6d3351
 }
6d3351
 
6d3351
 
6d3351
-- 
6d3351
2.12.2
6d3351