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

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



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


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