[libvirt] [PATCH 03/17] Fix leak in virDomainVcpuPinDefParseXML parsing cpumask

Doug Goldstein cardoe at gentoo.org
Tue Sep 24 19:54:24 UTC 2013


On Tue, Sep 24, 2013 at 11:03 AM, Daniel P. Berrange
<berrange at redhat.com> wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
>
> If the virBitmapParse method fails due to OOM, we leak
> the 'tmp' variable string.
>
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  src/conf/domain_conf.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index ccb61aa..aab6781 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -10614,8 +10614,10 @@ virDomainVcpuPinDefParseXML(const xmlNodePtr node,
>          int cpumasklen = VIR_DOMAIN_CPUMASK_LEN;
>
>          if (virBitmapParse(set, 0, &def->cpumask,
> -                           cpumasklen) < 0)
> -           goto error;
> +                           cpumasklen) < 0) {
> +            VIR_FREE(tmp);
> +            goto error;
> +        }
>          VIR_FREE(tmp);
>      } else {
>          virReportError(VIR_ERR_INTERNAL_ERROR,
> --
> 1.8.3.1
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

ACK

-- 
Doug Goldstein




More information about the libvir-list mailing list