]> xenbits.xensource.com Git - libvirt.git/commitdiff
virSysinfoParseXML: Mangle ctxt inside virSysinfoParseXML()
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 4 Jun 2020 12:57:12 +0000 (14:57 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 9 Jun 2020 13:20:16 +0000 (15:20 +0200)
There's no need to set ctxt->node outside of the function. The
function can set it itself - it has all the info needed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/conf/domain_conf.c

index e84fbe1e212abda4516eac446761c307b0dab7d3..57a5b7befe3f5d79fae7a4bf31c9cb97373d47fa 100644 (file)
@@ -15714,10 +15714,13 @@ virSysinfoParseXML(xmlNodePtr node,
                   unsigned char *domUUID,
                   bool uuid_generated)
 {
+    VIR_XPATH_NODE_AUTORESTORE(ctxt);
     virSysinfoDefPtr def;
     xmlNodePtr tmpnode;
     g_autofree char *type = NULL;
 
+    ctxt->node = node;
+
     if (!virXMLNodeNameEqual(node, "sysinfo")) {
         virReportError(VIR_ERR_XML_ERROR, "%s",
                        _("XML does not contain expected 'sysinfo' element"));
@@ -22179,8 +22182,6 @@ virDomainDefParseXML(xmlDocPtr xml,
     }
 
     if ((node = virXPathNode("./sysinfo[1]", ctxt)) != NULL) {
-        VIR_XPATH_NODE_AUTORESTORE(ctxt);
-        ctxt->node = node;
         def->sysinfo = virSysinfoParseXML(node, ctxt,
                                           def->uuid, uuid_generated);