[openib-general] [PATCH] cma_connect_ib leaks memory in failure cases.

Krishna Kumar krkumar2 at in.ibm.com
Thu Sep 7 22:13:13 PDT 2006


cma_connect_ib leaks an struct ib_cm_id* in failure cases.

Signed-off-by: Krishna Kumar <krkumar2 at in.ibm.com>

diff -ruNp org/core/cma.c new/core/cma.c
--- org/core/cma.c	2006-09-08 09:52:05.000000000 +0530
+++ new/core/cma.c	2006-09-08 09:52:30.000000000 +0530
@@ -1954,6 +1954,11 @@ static int cma_connect_ib(struct rdma_id
 
 	ret = ib_send_cm_req(id_priv->cm_id.ib, &req);
 out:
+	if (ret && !IS_ERR(id_priv->cm_id.ib)) {
+		ib_destroy_cm_id(id_priv->cm_id.ib);
+		id_priv->cm_id.ib = NULL;
+	}
+
 	kfree(private_data);
 	return ret;
 }




More information about the general mailing list