Re: [PATCH] Fix a memory leak in virCgroupGetPercpuStats

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

 



On 01/26/2015 10:22 AM, Ján Tomko wrote:
> ---
>  src/util/vircgroup.c  | 6 ++++--
>  tests/vircgrouptest.c | 1 +
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
> index e65617a..6957e81 100644
> --- a/src/util/vircgroup.c
> +++ b/src/util/vircgroup.c
> @@ -3061,8 +3061,10 @@ virCgroupGetPercpuStats(virCgroupPtr group,
>  
>      total_cpus = virBitmapSize(cpumap);
>  
> -    if (ncpus == 0)
> -        return total_cpus;
> +    if (ncpus == 0) {
> +        rv = total_cpus;
> +        goto cleanup;
> +    }
>  
>      if (start_cpu >= total_cpus) {
>          virReportError(VIR_ERR_INVALID_ARG,
> diff --git a/tests/vircgrouptest.c b/tests/vircgrouptest.c
> index a455a81..cc1825b 100644
> --- a/tests/vircgrouptest.c
> +++ b/tests/vircgrouptest.c
> @@ -614,6 +614,7 @@ static int testCgroupGetPercpuStats(const void *args ATTRIBUTE_UNUSED)
>  
>   cleanup:
>      virCgroupFree(&cgroup);
> +    VIR_FREE(params);
>      return ret;
>  }

Seems fine to me, ACK.

Erik

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