[lxc-devel] [PATCH] fix leak when a veth.pair name is specified

Stéphane Graber stgraber at ubuntu.com
Mon Nov 4 23:05:25 UTC 2013


On Mon, Nov 04, 2013 at 05:35:11PM -0500, Dwight Engen wrote:
> Signed-off-by: Dwight Engen <dwight.engen at oracle.com>

Acked-by: Stéphane Graber <stgraber at ubuntu.com>

> ---
>  src/lxc/conf.c    |  2 ++
>  src/lxc/confile.c | 14 +-------------
>  2 files changed, 3 insertions(+), 13 deletions(-)
> 
> diff --git a/src/lxc/conf.c b/src/lxc/conf.c
> index 2a47e77..0d1eccd 100644
> --- a/src/lxc/conf.c
> +++ b/src/lxc/conf.c
> @@ -3308,6 +3308,8 @@ static void lxc_remove_nic(struct lxc_list *it)
>  		free(netdev->link);
>  	if (netdev->name)
>  		free(netdev->name);
> +	if (netdev->priv.veth_attr.pair)
> +		free(netdev->priv.veth_attr.pair);
>  	if (netdev->upscript)
>  		free(netdev->upscript);
>  	if (netdev->hwaddr)
> diff --git a/src/lxc/confile.c b/src/lxc/confile.c
> index 680d260..0e0b7e8 100644
> --- a/src/lxc/confile.c
> +++ b/src/lxc/confile.c
> @@ -453,19 +453,7 @@ static struct lxc_netdev *network_netdev(const char *key, const char *value,
>  
>  static int network_ifname(char **valuep, const char *value)
>  {
> -	if (strlen(value) >= IFNAMSIZ) {
> -		ERROR("interface name '%s' too long (>%d)\n",
> -		value, IFNAMSIZ - 1);
> -		return -1;
> -	}
> -
> -	*valuep = strdup(value);
> -	if (!*valuep) {
> -		ERROR("failed to dup string '%s'", value);
> -		return -1;
> -	}
> -
> -	return 0;
> +	return config_string_item_max(valuep, value, IFNAMSIZ);
>  }
>  
>  #ifndef MACVLAN_MODE_PRIVATE
> -- 
> 1.8.3.1
> 
> 
> ------------------------------------------------------------------------------
> November Webinars for C, C++, Fortran Developers
> Accelerate application performance with scalable programming models. Explore
> techniques for threading, error checking, porting, and tuning. Get the most 
> from the latest Intel processors and coprocessors. See abstracts and register
> http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20131104/2d52eca4/attachment.pgp>


More information about the lxc-devel mailing list