@@ -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,7 @@ btl_openib_component_init(int *num_btl_modules,
27042714 }
27052715 }
27062716
2717+ // These are used nowhere else, ergo...
27072718 OBJ_CONSTRUCT (& mca_btl_openib_component .send_free_coalesced , opal_free_list_t );
27082719 OBJ_CONSTRUCT (& mca_btl_openib_component .send_user_free , opal_free_list_t );
27092720 OBJ_CONSTRUCT (& mca_btl_openib_component .recv_user_free , opal_free_list_t );
@@ -2733,6 +2744,7 @@ btl_openib_component_init(int *num_btl_modules,
27332744 goto no_btls ;
27342745 }
27352746
2747+ free (init_data );
27362748 init_data = (mca_btl_openib_frag_init_data_t * ) malloc (sizeof (mca_btl_openib_frag_init_data_t ));
27372749 if (NULL == init_data ) {
27382750 BTL_ERROR (("Failed malloc: %s:%d" , __FILE__ , __LINE__ ));
@@ -2754,6 +2766,7 @@ btl_openib_component_init(int *num_btl_modules,
27542766 goto no_btls ;
27552767 }
27562768
2769+ free (init_data );
27572770 init_data = (mca_btl_openib_frag_init_data_t * ) malloc (sizeof (mca_btl_openib_frag_init_data_t ));
27582771 if (NULL == init_data ) {
27592772 BTL_ERROR (("Failed malloc: %s:%d" , __FILE__ , __LINE__ ));
@@ -2773,6 +2786,8 @@ btl_openib_component_init(int *num_btl_modules,
27732786 goto no_btls ;
27742787 }
27752788
2789+ free (init_data );
2790+
27762791 /* If fork support is requested, try to enable it */
27772792 if (OPAL_SUCCESS != (ret = opal_common_verbs_fork_test ())) {
27782793 goto no_btls ;
@@ -3058,6 +3073,8 @@ btl_openib_component_init(int *num_btl_modules,
30583073 if (NULL != btls ) {
30593074 free (btls );
30603075 }
3076+
3077+ opal_ibv_free_device_list (ib_devs );
30613078 return NULL ;
30623079}
30633080
0 commit comments