]> git.openfabrics.org - ~ardavis/dapl.git/commitdiff
mpxyd: fix memory leak during smd proxy device close
authorPatrick Mccormick <patrick.m.mccormick@intel.com>
Thu, 7 Feb 2013 21:04:28 +0000 (13:04 -0800)
committerArlin Davis <arlin.r.davis@intel.com>
Thu, 7 Feb 2013 21:04:28 +0000 (13:04 -0800)
Need to cleanup the proxy buffer created during device open.
unregister the proxy buffer with both scif and IB and free memory.

Signed-off-by: Arlin Davis <arlin.r.davis@intel.com>
dapl/svc/mpxyd.c

index 9ecf780dc3b42db1e5bfeb0b03e4049bd4d11e43..296d0e88653877dc46f0d263bb28687df75598a6 100644 (file)
@@ -1539,6 +1539,16 @@ static void mcm_destroy_smd(mcm_scif_dev_t *smd)
        pthread_mutex_unlock(&smd->plock);
        mlog(1, " port space destroyed \n");
 
+       /* unregister scif window, ib mr, and free m_buf*/
+       if (smd->m_offset)
+               scif_unregister(smd->scif_tx_ep, smd->m_offset, smd->m_len);
+
+       if (smd->m_mr)
+               ibv_dereg_mr(smd->m_mr);
+
+       free (smd->m_buf);
+       mlog(1, " m_buf unregistered and freed \n");
+
        if (smd->ref_cnt) {
                mlog(0, " WARNING: ref_cnt not 0, = %d \n", smd->ref_cnt);
        }