diff --git a/opal/mca/btl/ugni/btl_ugni_endpoint.c b/opal/mca/btl/ugni/btl_ugni_endpoint.c index dc7e9dfd55..7496601944 100644 --- a/opal/mca/btl/ugni/btl_ugni_endpoint.c +++ b/opal/mca/btl/ugni/btl_ugni_endpoint.c @@ -77,8 +77,10 @@ int mca_btl_ugni_ep_disconnect (mca_btl_base_endpoint_t *ep, bool send_disconnec (void) opal_common_ugni_ep_destroy (&ep->rdma_ep_handle); OPAL_THREAD_UNLOCK(&ep->common->dev->dev_lock); - OMPI_FREE_LIST_RETURN_MT(&ep->btl->smsg_mboxes, ((ompi_free_list_item_t *) ep->mailbox)); - ep->mailbox = NULL; + if (ep->mailbox) { + OMPI_FREE_LIST_RETURN_MT(&ep->btl->smsg_mboxes, ((ompi_free_list_item_t *) ep->mailbox)); + ep->mailbox = NULL; + } ep->state = MCA_BTL_UGNI_EP_STATE_INIT; diff --git a/opal/mca/btl/ugni/btl_ugni_module.c b/opal/mca/btl/ugni/btl_ugni_module.c index ddfa6eb6e1..0bc4e59a27 100644 --- a/opal/mca/btl/ugni/btl_ugni_module.c +++ b/opal/mca/btl/ugni/btl_ugni_module.c @@ -166,14 +166,16 @@ mca_btl_ugni_module_finalize (struct mca_btl_base_module_t *btl) BTL_ERROR(("error tearing down RX SMSG CQ - %s",gni_err_str[rc])); } - rc = GNI_CqDestroy (ugni_module->rdma_local_irq_cq); - if (GNI_RC_SUCCESS != rc) { - BTL_ERROR(("error tearing down local BTE/FMA CQ - %s",gni_err_str[rc])); - } + if (mca_btl_ugni_component.progress_thread_enabled) { + rc = GNI_CqDestroy (ugni_module->rdma_local_irq_cq); + if (GNI_RC_SUCCESS != rc) { + BTL_ERROR(("error tearing down local BTE/FMA CQ - %s",gni_err_str[rc])); + } - rc = GNI_CqDestroy (ugni_module->smsg_remote_irq_cq); - if (GNI_RC_SUCCESS != rc) { - BTL_ERROR(("error tearing down remote SMSG CQ - %s",gni_err_str[rc])); + rc = GNI_CqDestroy (ugni_module->smsg_remote_irq_cq); + if (GNI_RC_SUCCESS != rc) { + BTL_ERROR(("error tearing down remote SMSG CQ - %s",gni_err_str[rc])); + } } /* cancel wildcard post */