Commit 542deb88 authored by Colin Ian King's avatar Colin Ian King Committed by David S. Miller

net/mlx4_core: fix memory leaks on error exit path

The structures hca_param and func_cap are not being kfree'd on an error
exit path causing two memory leaks. Fix this by jumping to the existing
free memory error exit path.

Detected by CoverityScan, CID#1455219, CID#1455224 ("Resource Leak")

Fixes: c73c8b1e ("net/mlx4_core: Dynamically allocate structs at mlx4_slave_cap")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Acked-by: default avatarTariq Toukan <tariqt@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 32d9b70a
...@@ -977,7 +977,8 @@ static int mlx4_slave_cap(struct mlx4_dev *dev) ...@@ -977,7 +977,8 @@ static int mlx4_slave_cap(struct mlx4_dev *dev)
if (dev->caps.num_ports > MLX4_MAX_PORTS) { if (dev->caps.num_ports > MLX4_MAX_PORTS) {
mlx4_err(dev, "HCA has %d ports, but we only support %d, aborting\n", mlx4_err(dev, "HCA has %d ports, but we only support %d, aborting\n",
dev->caps.num_ports, MLX4_MAX_PORTS); dev->caps.num_ports, MLX4_MAX_PORTS);
return -ENODEV; err = -ENODEV;
goto free_mem;
} }
mlx4_replace_zero_macs(dev); mlx4_replace_zero_macs(dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment