In case when the user specifies the '<hyperv/>' feature multiple times
we could overwrite already parsed data. Clear it beforehand.

As before this isn't trying to address the case of features being
specified multiple times not making much sense.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/675
Signed-off-by: Peter Krempa <[email protected]>
---
 src/conf/domain_conf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d72870d87d..e31b674bc2 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -16621,6 +16621,8 @@ virDomainFeaturesHyperVDefParse(virDomainDef *def,
             if (value != VIR_TRISTATE_SWITCH_ON)
                 break;

+            g_clear_pointer(&def->hyperv_vendor_id, g_free);
+
             if (!(def->hyperv_vendor_id = virXMLPropString(node, "value"))) {
                 virReportError(VIR_ERR_XML_ERROR, "%s",
                                _("missing 'value' attribute for HyperV feature 
'vendor_id'"));
-- 
2.46.0

Reply via email to