Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
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