]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
fix leak when a veth.pair name is specified
authorDwight Engen <dwight.engen@oracle.com>
Tue, 5 Nov 2013 17:26:34 +0000 (12:26 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Tue, 5 Nov 2013 17:31:59 +0000 (12:31 -0500)
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/conf.c
src/lxc/confile.c

index 2a47e77b3b113089b60f73a277ac588a6bda6ebb..c131259386d9a9138a9569b17a96cc444e551c6f 100644 (file)
@@ -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)
index 680d26080be676ddec8272ef376de1e264501ee8..0e0b7e89b1d5ea267cc3807c65a3e093e412af17 100644 (file)
@@ -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