]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
confile: safely clean previous value in set_config_net_ipv4_gateway()
authorChristian Brauner <christian.brauner@ubuntu.com>
Sun, 28 Mar 2021 15:58:18 +0000 (17:58 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 29 Mar 2021 08:07:39 +0000 (10:07 +0200)
Link: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32586
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/confile.c

index 375960212db8f212ab0e94fc09b8b023490beaa5..ba9420c720780e97e5d3ef28b768176d9e4cc2fe 100644 (file)
@@ -787,10 +787,9 @@ static int set_config_net_ipv4_gateway(const char *key, const char *value,
        if (!netdev)
                return ret_errno(EINVAL);
 
+       clr_config_net_ipv4_gateway(key, lxc_conf, data);
        if (lxc_config_value_empty(value))
-               return clr_config_net_ipv4_gateway(key, lxc_conf, data);
-
-       free(netdev->ipv4_gateway);
+               return 0;
 
        if (strequal(value, "auto")) {
                netdev->ipv4_gateway = NULL;