]> git.openfabrics.org - ~ardavis/dapl.git/commitdiff
mpxyd: fix ibctx leak with device open
authorArlin Davis <arlin.r.davis@intel.com>
Tue, 25 Feb 2014 18:28:51 +0000 (10:28 -0800)
committerArlin Davis <arlin.r.davis@intel.com>
Tue, 25 Feb 2014 18:28:51 +0000 (10:28 -0800)
Signed-off-by: Arlin Davis <arlin.r.davis@intel.com>
dapl/svc/mpxyd.c

index d9e6169c39c1a2f6e89282096fd311c33a77ee1f..b05ac63fe62a4745d31cbf60bb595da0438fd369 100644 (file)
@@ -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 {