From e5e270badab4f5399bb158ce67fbb46a3b5104c0 Mon Sep 17 00:00:00 2001 From: Arlin Davis Date: Tue, 25 Feb 2014 10:28:51 -0800 Subject: [PATCH] mpxyd: fix ibctx leak with device open Signed-off-by: Arlin Davis --- dapl/svc/mpxyd.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/dapl/svc/mpxyd.c b/dapl/svc/mpxyd.c index d9e6169..b05ac63 100644 --- a/dapl/svc/mpxyd.c +++ b/dapl/svc/mpxyd.c @@ -180,11 +180,6 @@ static struct ibv_context *open_ib_device(struct mcm_ib_dev *md, char *name, int } for (i=0; i < ibcnt; ++i) { - ibctx = ibv_open_device(iblist[i]); - if (!ibctx) { - mlog(0,"ERR ibv_open, %s\n", strerror(errno)); - goto bail; - } if (!strcmp(iblist[i]->name, name)) { ibctx = ibv_open_device(iblist[i]); if (!ibctx) { @@ -193,6 +188,8 @@ static struct ibv_context *open_ib_device(struct mcm_ib_dev *md, char *name, int } if (ibv_query_port(ibctx, port, &port_attr)) { mlog(0,"ERR ibv_query, %s\n", strerror(errno)); + ibv_close_device(ibctx); + ibctx = NULL; goto bail; } else { -- 2.46.0