@@ -211,6 +211,11 @@ static int btl_openib_component_close(void)
211211 OBJ_DESTRUCT (& mca_btl_openib_component .srq_manager .lock );
212212 OBJ_DESTRUCT (& mca_btl_openib_component .srq_manager .srq_addr_table );
213213
214+ /* destroy the tx/rx queues */
215+ OBJ_DESTRUCT (& mca_btl_openib_component .send_free_coalesced );
216+ OBJ_DESTRUCT (& mca_btl_openib_component .send_user_free );
217+ OBJ_DESTRUCT (& mca_btl_openib_component .recv_user_free );
218+
214219 opal_btl_openib_connect_base_finalize ();
215220 opal_btl_openib_ini_finalize ();
216221
@@ -912,6 +917,7 @@ static void device_construct(mca_btl_openib_device_t *device)
912917 device -> ib_channel = NULL ;
913918#endif
914919 device -> btls = 0 ;
920+ device -> allowed_btls = 0 ;
915921 device -> endpoints = NULL ;
916922 device -> device_btls = NULL ;
917923 device -> ib_cq [BTL_OPENIB_HP_CQ ] = NULL ;
@@ -1876,6 +1882,8 @@ static int init_one_device(opal_list_t *btl_list, struct ibv_device* ib_dev)
18761882 device -> rcache =
18771883 mca_rcache_base_module_create (mca_btl_openib_component .ib_rcache_name ,
18781884 device , & rcache_resources );
1885+ free (rcache_resources .cache_name );
1886+
18791887 if (NULL == device -> rcache ) {
18801888 /* Don't print an error message here -- we'll get one from
18811889 mpool_create anyway */
@@ -2277,6 +2285,7 @@ static int init_one_device(opal_list_t *btl_list, struct ibv_device* ib_dev)
22772285 } else if (device -> btls > 0 ) {
22782286 /* no port is allowed to be used by btl/openib,
22792287 * so release the device right away */
2288+ OBJ_RELEASE (device -> device_btls );
22802289 OBJ_RELEASE (device );
22812290 return OPAL_SUCCESS ;
22822291 }
@@ -2292,6 +2301,7 @@ static int init_one_device(opal_list_t *btl_list, struct ibv_device* ib_dev)
22922301 if (NULL != allowed_ports ) {
22932302 free (allowed_ports );
22942303 }
2304+ OBJ_RELEASE (device -> device_btls );
22952305 OBJ_RELEASE (device );
22962306 return ret ;
22972307}
@@ -2704,6 +2714,8 @@ btl_openib_component_init(int *num_btl_modules,
27042714 }
27052715 }
27062716
2717+
2718+ // These are used nowhere else, ergo...
27072719 OBJ_CONSTRUCT (& mca_btl_openib_component .send_free_coalesced , opal_free_list_t );
27082720 OBJ_CONSTRUCT (& mca_btl_openib_component .send_user_free , opal_free_list_t );
27092721 OBJ_CONSTRUCT (& mca_btl_openib_component .recv_user_free , opal_free_list_t );
@@ -2733,6 +2745,7 @@ btl_openib_component_init(int *num_btl_modules,
27332745 goto no_btls ;
27342746 }
27352747
2748+ free (init_data );
27362749 init_data = (mca_btl_openib_frag_init_data_t * ) malloc (sizeof (mca_btl_openib_frag_init_data_t ));
27372750 if (NULL == init_data ) {
27382751 BTL_ERROR (("Failed malloc: %s:%d" , __FILE__ , __LINE__ ));
@@ -2754,6 +2767,7 @@ btl_openib_component_init(int *num_btl_modules,
27542767 goto no_btls ;
27552768 }
27562769
2770+ free (init_data );
27572771 init_data = (mca_btl_openib_frag_init_data_t * ) malloc (sizeof (mca_btl_openib_frag_init_data_t ));
27582772 if (NULL == init_data ) {
27592773 BTL_ERROR (("Failed malloc: %s:%d" , __FILE__ , __LINE__ ));
@@ -2773,6 +2787,8 @@ btl_openib_component_init(int *num_btl_modules,
27732787 goto no_btls ;
27742788 }
27752789
2790+ free (init_data );
2791+
27762792 /* If fork support is requested, try to enable it */
27772793 if (OPAL_SUCCESS != (ret = opal_common_verbs_fork_test ())) {
27782794 goto no_btls ;
@@ -3058,6 +3074,8 @@ btl_openib_component_init(int *num_btl_modules,
30583074 if (NULL != btls ) {
30593075 free (btls );
30603076 }
3077+
3078+ opal_ibv_free_device_list (ib_devs );
30613079 return NULL ;
30623080}
30633081
0 commit comments