Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

IB/mlx4: Fix memory leaks in ib_link_query_port()

If the call to mlx4_MAD_IFC() fails in ib_link_query_port() we will
currently do 'return err;' which will leak 'in_mad' and 'out_mad'.  We
should instead do 'goto out;' where we'll properly free the memory we
previously allocated.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Acked-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
  • Loading branch information...
commit bf6b47deb40f9fc8ddb4573373dc9614aab59d35 1 parent 0034102
Jesper Juhl authored April 11, 2012 rolandd committed April 24, 2012

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. 2  drivers/infiniband/hw/mlx4/main.c
2  drivers/infiniband/hw/mlx4/main.c
@@ -247,7 +247,7 @@ static int ib_link_query_port(struct ib_device *ibdev, u8 port,
247 247
 		err = mlx4_MAD_IFC(to_mdev(ibdev), 1, 1, port,
248 248
 				   NULL, NULL, in_mad, out_mad);
249 249
 		if (err)
250  
-			return err;
  250
+			goto out;
251 251
 
252 252
 		/* Checking LinkSpeedActive for FDR-10 */
253 253
 		if (out_mad->data[15] & 0x1)

0 notes on commit bf6b47d

Please sign in to comment.
Something went wrong with that request. Please try again.