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