[libvirt] [libvirt-glib] Correctly handle blank nodes in _foreach_child

Christophe Fergeau cfergeau at redhat.com
Thu Jan 26 09:25:29 UTC 2012


When encountering a blank node, the child iterator wasn't set to
point to the next node leading to an infinite loop.
---
 libvirt-gconfig/libvirt-gconfig-helpers.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-helpers.c b/libvirt-gconfig/libvirt-gconfig-helpers.c
index 6500439..071a1e7 100644
--- a/libvirt-gconfig/libvirt-gconfig-helpers.c
+++ b/libvirt-gconfig/libvirt-gconfig-helpers.c
@@ -172,14 +172,14 @@ void gvir_config_xml_foreach_child(xmlNodePtr node,
 
     it = node->children;
     while (it != NULL) {
-        gboolean cont;
         xmlNodePtr next = it->next;
 
-        if (xmlIsBlankNode(it))
-            continue;
-        cont = iter_func(it, opaque);
-        if (!cont)
-            break;
+        if (!xmlIsBlankNode(it)) {
+            gboolean cont;
+            cont = iter_func(it, opaque);
+            if (!cont)
+                break;
+        }
         it = next;
     }
 }
-- 
1.7.7.6




More information about the libvir-list mailing list