From: Peter Krempa Date: Mon, 24 Jun 2019 16:12:48 +0000 (+0200) Subject: conf: domain: Restore XPath context after virSecurityDeviceLabelDefParseXML X-Git-Tag: v5.5.0-rc1~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4fc84496914eedadd7020ce278f3e758c648e64f;p=thirdparty%2Flibvirt.git conf: domain: Restore XPath context after virSecurityDeviceLabelDefParseXML The function modifies the context but did not care to restore it back. If a was used on a disk, the would not be parsed. Use VIR_XPATH_NODE_AUTORESTORE and add a test case to validate that everything works. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 33253edfdd..3323c9a5b1 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8872,6 +8872,7 @@ virSecurityDeviceLabelDefParseXML(virSecurityDeviceLabelDefPtr **seclabels_rtn, xmlXPathContextPtr ctxt, unsigned int flags) { + VIR_XPATH_NODE_AUTORESTORE(ctxt); virSecurityDeviceLabelDefPtr *seclabels = NULL; size_t nseclabels = 0; int n; diff --git a/tests/qemustatusxml2xmldata/modern-in.xml b/tests/qemustatusxml2xmldata/modern-in.xml index 08f7f40761..f7104efa01 100644 --- a/tests/qemustatusxml2xmldata/modern-in.xml +++ b/tests/qemustatusxml2xmldata/modern-in.xml @@ -311,6 +311,9 @@ + + +