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

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



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


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