Re: [PATCH] Fix leak on OOM in virNWFilterVarValueCreateSimpleCopyValue

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

 



On 04/08/2014 08:47 AM, Daniel P. Berrange wrote:
> If virNWFilterVarValueCreateSimple fails with OOM, then
> 'val' will be leaked by virNWFilterVarValueCreateSimpleCopyValue
> 
> Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
> ---
>  src/conf/nwfilter_params.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

ACK

> 
> diff --git a/src/conf/nwfilter_params.c b/src/conf/nwfilter_params.c
> index 40eccc4..3e85bc1 100644
> --- a/src/conf/nwfilter_params.c
> +++ b/src/conf/nwfilter_params.c
> @@ -126,10 +126,14 @@ virNWFilterVarValuePtr
>  virNWFilterVarValueCreateSimpleCopyValue(const char *value)
>  {
>      char *val;
> +    virNWFilterVarValuePtr ret;
>  
>      if (VIR_STRDUP(val, value) < 0)
>          return NULL;
> -    return virNWFilterVarValueCreateSimple(val);
> +    ret = virNWFilterVarValueCreateSimple(val);
> +    if (!ret)
> +        VIR_FREE(val);
> +    return ret;
>  }
>  
>  const char *
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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