From: Dwight Engen Date: Tue, 5 Nov 2013 17:26:34 +0000 (-0500) Subject: fix leak when a veth.pair name is specified X-Git-Tag: lxc-1.0.0.alpha3~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9bb9a85ef570a4669d188f191e08cdd601d0ee5;p=thirdparty%2Flxc.git fix leak when a veth.pair name is specified Signed-off-by: Dwight Engen Acked-by: Stéphane Graber --- diff --git a/src/lxc/conf.c b/src/lxc/conf.c index 2a47e77b3..c13125938 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->type == LXC_NET_VETH && 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 680d26080..0e0b7e89b 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