]> git.proxmox.com Git - mirror_lxc.git/commitdiff
network: Adds calls to free_ovs_veth_vlan_args in setup_veth_ovs_bridge_vlan
authorThomas Parrott <thomas.parrott@canonical.com>
Tue, 9 Jun 2020 12:04:21 +0000 (13:04 +0100)
committerThomas Parrott <thomas.parrott@canonical.com>
Tue, 9 Jun 2020 13:05:16 +0000 (14:05 +0100)
Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
src/lxc/network.c

index 058469b1ea1c87f9996449e4c9f5495b6c6353e8..b64c62d494b9192a9232d51def9a7ea87c2ede3f 100644 (file)
@@ -510,8 +510,10 @@ static int setup_veth_ovs_bridge_vlan(char *veth1, struct lxc_netdev *netdev)
                        int rc;
 
                        rc = snprintf(buf, sizeof(buf), "%u", vlan_id);
-                       if (rc < 0 || (size_t)rc >= sizeof(buf))
+                       if (rc < 0 || (size_t)rc >= sizeof(buf)) {
+                               free_ovs_veth_vlan_args(&args);
                                return log_error_errno(-1, EINVAL, "Failed to parse tagged vlan \"%u\" for interface \"%s\"", vlan_id, veth1);
+                       }
 
                        if (args.trunks)
                                args.trunks = must_concat(NULL, args.trunks, buf, ",", (char *)NULL);
@@ -525,10 +527,13 @@ static int setup_veth_ovs_bridge_vlan(char *veth1, struct lxc_netdev *netdev)
                char cmd_output[PATH_MAX];
 
                ret = run_command(cmd_output, sizeof(cmd_output), lxc_ovs_setup_bridge_vlan_exec, (void *)&args);
-               if (ret < 0)
+               if (ret < 0) {
+                       free_ovs_veth_vlan_args(&args);
                        return log_error_errno(-1, ret, "Failed to setup openvswitch vlan on port \"%s\": %s", args.nic, cmd_output);
+               }
        }
 
+       free_ovs_veth_vlan_args(&args);
        return 0;
 }