Skip to content

Commit

Permalink
fix leak when a veth.pair name is specified
Browse files Browse the repository at this point in the history
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
  • Loading branch information
Dwight Engen authored and stgraber committed Nov 5, 2013
1 parent 8585f20 commit c9bb9a8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
2 changes: 2 additions & 0 deletions src/lxc/conf.c
Expand Up @@ -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)
Expand Down
14 changes: 1 addition & 13 deletions src/lxc/confile.c
Expand Up @@ -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
Expand Down

0 comments on commit c9bb9a8

Please sign in to comment.