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

Stefan Berger stefanb at linux.vnet.ibm.com
Mon Nov 28 17:01:55 UTC 2011


On 11/28/2011 11:46 AM, Michal Privoznik wrote:
> 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;
ACK




More information about the libvir-list mailing list