From: Jiri Denemark Date: Thu, 16 Mar 2017 11:21:58 +0000 (+0100) Subject: cpu_conf: Introduce virCPUDefFreeFeatures X-Git-Tag: v3.2.0-rc1~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=532fc7b7733883554e0805f7b0594b741c1a4bc4;p=thirdparty%2Flibvirt.git cpu_conf: Introduce virCPUDefFreeFeatures Signed-off-by: Jiri Denemark --- diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index d7c8b8ff21..b78531e602 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 +virCPUDefFreeFeatures(virCPUDefPtr def) +{ + size_t i; + + 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) { - 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); + virCPUDefFreeFeatures(def); } void diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h index 9118f037ed..3e02deed4b 100644 --- a/src/conf/cpu_conf.h +++ b/src/conf/cpu_conf.h @@ -124,6 +124,9 @@ struct _virCPUDef { }; +void ATTRIBUTE_NONNULL(1) +virCPUDefFreeFeatures(virCPUDefPtr def); + void ATTRIBUTE_NONNULL(1) virCPUDefFreeModel(virCPUDefPtr def); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index df200951a2..1e160d80e9 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -75,6 +75,7 @@ virCPUDefCopyWithoutModel; virCPUDefFormat; virCPUDefFormatBuf; virCPUDefFree; +virCPUDefFreeFeatures; virCPUDefFreeModel; virCPUDefParseXML; virCPUDefStealModel;