diff --git a/opal/class/opal_object.h b/opal/class/opal_object.h index 45cb4ac0608..0d1e8b68478 100644 --- a/opal/class/opal_object.h +++ b/opal/class/opal_object.h @@ -479,7 +479,7 @@ static inline void opal_obj_run_destructors(opal_object_t * object) assert(NULL != object->obj_class); cls_destruct = object->obj_class->cls_destruct_array; - while( NULL != *cls_destruct ) { + while( cls_destruct ) { (*cls_destruct)(object); cls_destruct++; } diff --git a/opal/mca/btl/ofi/btl_ofi_component.c b/opal/mca/btl/ofi/btl_ofi_component.c index bc4342c6423..b651d43eb88 100644 --- a/opal/mca/btl/ofi/btl_ofi_component.c +++ b/opal/mca/btl/ofi/btl_ofi_component.c @@ -675,8 +675,10 @@ static int mca_btl_ofi_init_device(struct fi_info *info) /* if the contexts have not been initiated, num_contexts should * be zero and we skip this. */ - for (int i=0; i < module->num_contexts; i++) { - mca_btl_ofi_context_finalize(&module->contexts[i], module->is_scalable_ep); + if (module->contexts) { + for (int i=0; i < module->num_contexts; i++) { + mca_btl_ofi_context_finalize(&module->contexts[i], module->is_scalable_ep); + } } free(module->contexts);