Commit c9bb9a85 by Dwight Engen Committed by Stéphane Graber

fix leak when a veth.pair name is specified

parent 8585f204
...@@ -3308,6 +3308,8 @@ static void lxc_remove_nic(struct lxc_list *it) ...@@ -3308,6 +3308,8 @@ static void lxc_remove_nic(struct lxc_list *it)
free(netdev->link); free(netdev->link);
if (netdev->name) if (netdev->name)
free(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) if (netdev->upscript)
free(netdev->upscript); free(netdev->upscript);
if (netdev->hwaddr) if (netdev->hwaddr)
......
...@@ -453,19 +453,7 @@ static struct lxc_netdev *network_netdev(const char *key, const char *value, ...@@ -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) static int network_ifname(char **valuep, const char *value)
{ {
if (strlen(value) >= IFNAMSIZ) { return config_string_item_max(valuep, 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;
} }
#ifndef MACVLAN_MODE_PRIVATE #ifndef MACVLAN_MODE_PRIVATE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment