Re: [PATCH 07/11] xend: Fix a memory leak found by Coverity

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

 



John Ferlan wrote:
> Commit id '87b4c10c' moved the VIR_ALLOC_N, but didn't check if 'cpuset'
> had been allocated on failure.
> ---
>  src/xen/xend_internal.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
> index a8e276d..51f1f15 100644
> --- a/src/xen/xend_internal.c
> +++ b/src/xen/xend_internal.c
> @@ -1130,8 +1130,10 @@ sexpr_to_xend_topology(const struct sexpr *root,
>                  goto error;
>          }
>  
> -        if (VIR_ALLOC_N(cpuInfo, numCpus) < 0)
> +        if (VIR_ALLOC_N(cpuInfo, numCpus) < 0) {
> +            virBitmapFree(cpuset);
>              goto memory_error;
> +        }
>  
>          for (n = 0, cpu = 0; cpu < numCpus; cpu++) {
>              bool used;
>   

ACK.

Regards,
Jim

--
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]