Messages in this thread Patch in this message |  | | | Date | Wed, 11 Apr 2012 23:43:29 +0200 (CEST) | | From | Jesper Juhl <> | | Subject | [PATCH] IB: mlx4: Fix mem leaks in ib_link_query_port() |
| |
If, in ib_link_query_port(), the call to mlx4_MAD_IFC() fails we will currently do 'return err;' which will leak 'in_mad' and 'out_mad' that we previously allocated. I believe we should instead do 'goto out;' where we'll properly free the memory we previously allocated.
Signed-off-by: Jesper Juhl <jj@chaosbits.net> --- drivers/infiniband/hw/mlx4/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 75d3056..cc88c9c 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c @@ -247,7 +247,7 @@ static int ib_link_query_port(struct ib_device *ibdev, u8 port, err = mlx4_MAD_IFC(to_mdev(ibdev), 1, 1, port, NULL, NULL, in_mad, out_mad); if (err) - return err; + goto out; /* Checking LinkSpeedActive for FDR-10 */ if (out_mad->data[15] & 0x1) -- 1.7.10
-- Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/ Don't top-post http://www.catb.org/jargon/html/T/top-post.html Plain text mails only, please.
|  |