[libvirt] [PATCH 3/4] conf: Fix XML ctxt swap in virDomainNetDefParseXML

John Ferlan jferlan at redhat.com
Wed Feb 20 14:46:58 UTC 2019


Alter the logic to return @tmpnode to ctxt->node in both the error
and non-error path when calling virDomainNetIPInfoParseXML.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/conf/domain_conf.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ddcb76f05d..d550b467f7 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11356,10 +11356,11 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
                 xmlNodePtr tmpnode = ctxt->node;
 
                 ctxt->node = cur;
-                if (virDomainNetIPInfoParseXML(_("interface host IP"),
-                                               ctxt, &def->hostIP) < 0)
-                    goto error;
+                rv = virDomainNetIPInfoParseXML(_("interface host IP"),
+                                                ctxt, &def->hostIP);
                 ctxt->node = tmpnode;
+                if (rv < 0)
+                    goto error;
             }
             if (!macaddr && virXMLNodeNameEqual(cur, "mac")) {
                 macaddr = virXMLPropString(cur, "address");
-- 
2.20.1




More information about the libvir-list mailing list