[PATCH] virsh: Don't traverse childless nodes in vshNodeIsSuperset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index 16d815c..6ed249b 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -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;
-- 
1.7.3.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]