[ewg] [PATCH] IB/libipathverbs: fix memory leak in error path
Ralph Campbell
ralph.campbell at qlogic.com
Thu Mar 12 15:05:36 PDT 2009
Vlad,
Please pull for OFED-1.4.1:
git://git.openfabrics.org/~ralphc/libipathverbs/.git ofed_1_4
commit 337df3c1cbe43c3e9cb58e7f6e91f44603dd23fb
Author: Patrick Latifi <patrick.latifi at qlogic.com>
Date: Thu Mar 12 12:46:25 2009 -0700
IB/libipathverbs: fix memory leak in error path
If the CQ or QP is created but the queue cannot be mmapped, be sure
to delete the allocated CQ or QP.
Signed-off-by: Patrick Latifi <patrick.latifi at qlogic.com>
diff --git a/src/verbs.c b/src/verbs.c
index dcd8efb..b73b7f7 100644
--- a/src/verbs.c
+++ b/src/verbs.c
@@ -182,6 +182,7 @@ struct ibv_cq *ipath_create_cq(struct ibv_context *context, int cqe,
cq->queue = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED,
context->cmd_fd, resp.offset);
if ((void *) cq->queue == MAP_FAILED) {
+ ibv_cmd_destroy_cq(&cq->ibv_cq);
free(cq);
return NULL;
}
@@ -338,6 +339,7 @@ struct ibv_qp *ipath_create_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *attr)
PROT_READ | PROT_WRITE, MAP_SHARED,
pd->context->cmd_fd, resp.offset);
if ((void *) qp->rq.rwq == MAP_FAILED) {
+ ibv_cmd_destroy_qp(&qp->ibv_qp);
free(qp);
return NULL;
}
@@ -532,6 +534,7 @@ struct ibv_srq *ipath_create_srq(struct ibv_pd *pd,
srq->rq.rwq = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED,
pd->context->cmd_fd, resp.offset);
if ((void *) srq->rq.rwq == MAP_FAILED) {
+ ibv_cmd_destroy_srq(&srq->ibv_srq);
free(srq);
return NULL;
}
More information about the ewg
mailing list