]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
confile: cleanup set_config_net_hwaddr()
authorChristian Brauner <christian.brauner@ubuntu.com>
Mon, 29 Mar 2021 10:13:43 +0000 (12:13 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 29 Mar 2021 10:26:11 +0000 (12:26 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/confile.c

index 35c65b99d93fd480eeb4b78b582d1b0d046d0556..ff4728c9e543dfed46233ed553918995a02957d1 100644 (file)
@@ -660,16 +660,15 @@ static int set_config_net_hwaddr(const char *key, const char *value,
        if (!netdev)
                return ret_errno(EINVAL);
 
+       clr_config_net_hwaddr(key, lxc_conf, data);
        if (lxc_config_value_empty(value))
-               return clr_config_net_hwaddr(key, lxc_conf, data);
+               return 0;
 
        new_value = strdup(value);
        if (!new_value)
                return ret_errno(ENOMEM);
 
        rand_complete_hwaddr(new_value);
-
-       free_disarm(netdev->hwaddr);
        if (!lxc_config_value_empty(new_value))
                netdev->hwaddr = move_ptr(new_value);