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

Jim Fehlig jfehlig at suse.com
Fri Feb 8 02:50:59 UTC 2013


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




More information about the libvir-list mailing list