Re: [PATCH libnfntl] Check all strdup

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

 



On Mon, May 30, 2016 at 07:03:42PM +0200, Carlos Falgueras García wrote:
> diff --git a/src/set.c b/src/set.c
> index dbea93b..65b8f1e 100644
> --- a/src/set.c
> +++ b/src/set.c
> @@ -291,10 +295,16 @@ struct nftnl_set *nftnl_set_clone(const struct nftnl_set *set)
>  
>  	memcpy(newset, set, sizeof(*set));
>  
> -	if (set->flags & (1 << NFTNL_SET_TABLE))
> +	if (set->flags & (1 << NFTNL_SET_TABLE)) {
>  		newset->table = strdup(set->table);
> -	if (set->flags & (1 << NFTNL_SET_NAME))
> +		if (!newset->table)
> +			return NULL;
> +	}
> +	if (set->flags & (1 << NFTNL_SET_NAME)) {
>  		newset->name = strdup(set->name);
> +		if (!newset->name)
> +			return NULL;
> +	}

This is leaking the clone object.

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux