Skip to content

Commit

Permalink
Set the right variable to NULL when unsetting ipv6_gateway
Browse files Browse the repository at this point in the history
We were freeing one and setting a different one to NULL, eventually
leading to a crash when closing the netdev (at container shutdown)
and freeing already-freed memory.

Closes #732

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
  • Loading branch information
hallyn committed Jan 12, 2016
1 parent c7ec3de commit ffe3443
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lxc/confile.c
Expand Up @@ -971,7 +971,7 @@ static int config_network_ipv6_gateway(const char *key, const char *value,
free(netdev->ipv6_gateway);

if (!value || strlen(value) == 0) {
netdev->ipv4_gateway = NULL;
netdev->ipv6_gateway = NULL;
} else if (!strcmp(value, "auto")) {
netdev->ipv6_gateway = NULL;
netdev->ipv6_gateway_auto = true;
Expand Down

0 comments on commit ffe3443

Please sign in to comment.