From: Serge Hallyn Date: Tue, 12 Jan 2016 02:25:19 +0000 (-0800) Subject: Set the right variable to NULL when unsetting ipv6_gateway X-Git-Tag: lxc-2.0.0.beta2~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ffe344373e5d2b9f2be517f138bf42f9c7d0ca20;p=thirdparty%2Flxc.git Set the right variable to NULL when unsetting ipv6_gateway 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 --- diff --git a/src/lxc/confile.c b/src/lxc/confile.c index 1185d7df6..c81ba45be 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -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;