]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: Don't traverse childless nodes in vshNodeIsSuperset
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 28 Nov 2011 16:43:51 +0000 (17:43 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 28 Nov 2011 17:17:14 +0000 (18:17 +0100)
If both nodes do not have any children, we pass zero to
virBitmapAlloc which returns NULL. In turn we report OOM error
and return false (meaning nodes are different). This is not true.

tools/virsh.c

index 16d815c9ad9d6babf246b1109b0629e759a34b89..6ed249ba45fe95e2284cfc74ca904f43caaf1350 100644 (file)
@@ -11556,6 +11556,9 @@ vshNodeIsSuperset(xmlNodePtr n1, xmlNodePtr n2)
     if (n1_child_size < n2_child_size)
         return false;
 
+    if (n1_child_size == 0 && n2_child_size == 0)
+        return true;
+
     if (!(bitmap = virBitmapAlloc(n1_child_size))) {
         virReportOOMError();
         return false;