net/mlx5: E-Switch, Fix error flow memory leak
authorMohamad Haj Yahia <mohamad@mellanox.com>
Tue, 3 May 2016 14:13:56 +0000 (17:13 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 4 May 2016 18:04:47 +0000 (14:04 -0400)
Fix memory leak in case query nic vport command failed.

Fixes: 81848731ff40 ('net/mlx5: E-Switch, Add SR-IOV (FDB) support')
Signed-off-by: Mohamad Haj Yahia <mohamad@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c

index f01903a99993a0b9eaa6cbcee1d435b7e3731ea3..c975ff593dfc1a56a26aac8a4cc69a1b3244abfb 100644 (file)
@@ -646,7 +646,7 @@ static void esw_update_vport_addr_list(struct mlx5_eswitch *esw,
        err = mlx5_query_nic_vport_mac_list(esw->dev, vport_num, list_type,
                                            mac_list, &size);
        if (err)
-               return;
+               goto out;
        esw_debug(esw->dev, "vport[%d] context update %s list size (%d)\n",
                  vport_num, is_uc ? "UC" : "MC", size);
 
@@ -674,6 +674,7 @@ static void esw_update_vport_addr_list(struct mlx5_eswitch *esw,
                addr->vport = vport_num;
                addr->action = MLX5_ACTION_ADD;
        }
+out:
        kfree(mac_list);
 }