[lxc-devel] [PATCH] fix leak when a veth.pair name is specified
Dwight Engen
dwight.engen at oracle.com
Mon Nov 4 22:35:11 UTC 2013
Signed-off-by: Dwight Engen <dwight.engen at oracle.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
More information about the lxc-devel
mailing list