[PATCH 01/14] cpu_conf: Introduce virCPUDefFreeFeatures

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/conf/cpu_conf.c      | 21 +++++++++++++++------
 src/conf/cpu_conf.h      |  3 +++
 src/libvirt_private.syms |  1 +
 3 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index d7c8b8ff2..b78531e60 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -62,18 +62,27 @@ VIR_ENUM_IMPL(virCPUFeaturePolicy, VIR_CPU_FEATURE_LAST,
               "disable",
               "forbid")
 
-void ATTRIBUTE_NONNULL(1)
-virCPUDefFreeModel(virCPUDefPtr def)
+void
+virCPUDefFreeFeatures(virCPUDefPtr def)
 {
     size_t i;
 
-    VIR_FREE(def->model);
-    VIR_FREE(def->vendor);
-    VIR_FREE(def->vendor_id);
-
     for (i = 0; i < def->nfeatures; i++)
         VIR_FREE(def->features[i].name);
     VIR_FREE(def->features);
+
+    def->nfeatures = def->nfeatures_max = 0;
+}
+
+
+void ATTRIBUTE_NONNULL(1)
+virCPUDefFreeModel(virCPUDefPtr def)
+{
+
+    VIR_FREE(def->model);
+    VIR_FREE(def->vendor);
+    VIR_FREE(def->vendor_id);
+    virCPUDefFreeFeatures(def);
 }
 
 void
diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h
index 9118f037e..3e02deed4 100644
--- a/src/conf/cpu_conf.h
+++ b/src/conf/cpu_conf.h
@@ -125,6 +125,9 @@ struct _virCPUDef {
 
 
 void ATTRIBUTE_NONNULL(1)
+virCPUDefFreeFeatures(virCPUDefPtr def);
+
+void ATTRIBUTE_NONNULL(1)
 virCPUDefFreeModel(virCPUDefPtr def);
 
 void
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 165d8cb25..7ac5e533f 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -71,6 +71,7 @@ virCPUDefCopyWithoutModel;
 virCPUDefFormat;
 virCPUDefFormatBuf;
 virCPUDefFree;
+virCPUDefFreeFeatures;
 virCPUDefFreeModel;
 virCPUDefParseXML;
 virCPUDefStealModel;
-- 
2.12.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux