@@ -315,7 +315,7 @@ static int ompi_comm_ext_cid_new_block (ompi_communicator_t *newcomm, ompi_commu
315315    opal_process_name_t  opal_proc_name ;
316316    bool  cid_base_set  =  false;
317317    char  * tag  =  NULL ;
318-     size_t  proc_count  =  0 , rproc_count  =  0 , cid_base  =  0UL , ninfo ;
318+     size_t  proc_count  =  0 , rproc_count  =  0 , tproc_count   =   0 ,  cid_base  =  0UL , ninfo ;
319319    int  rc , leader_rank ;
320320    pmix_proc_t  * procs ;
321321    void  * grpinfo  =  NULL , * list  =  NULL ;
@@ -338,13 +338,15 @@ static int ompi_comm_ext_cid_new_block (ompi_communicator_t *newcomm, ompi_commu
338338
339339    grpinfo  =  PMIx_Info_list_start ();
340340    if  (NULL  ==  grpinfo ) {
341-         return  OMPI_ERR_OUT_OF_RESOURCE  ;
341+         rc  =  OMPI_ERR_OUT_OF_RESOURCE ;
342+         goto fn_exit ;
342343    }
343344
344345    rc  =  PMIx_Info_list_add (grpinfo , PMIX_GROUP_ASSIGN_CONTEXT_ID , NULL , PMIX_BOOL );
345346    if  (PMIX_SUCCESS  !=  rc ) {
346347        OPAL_OUTPUT_VERBOSE ((10 , ompi_comm_output , "PMIx_Info_list_add failed %s %d" , PMIx_Error_string (rc ), __LINE__ ));
347-         return  OMPI_ERR_OUT_OF_RESOURCE  ;
348+         rc  =  OMPI_ERR_OUT_OF_RESOURCE ;
349+         goto fn_exit ;
348350    }
349351
350352    list  =  PMIx_Info_list_start ();
@@ -353,32 +355,34 @@ static int ompi_comm_ext_cid_new_block (ompi_communicator_t *newcomm, ompi_commu
353355    rc  =  PMIx_Info_list_add (list , PMIX_GROUP_LOCAL_CID , & c_index , PMIX_SIZE );
354356    if  (PMIX_SUCCESS  !=  rc ) {
355357        OPAL_OUTPUT_VERBOSE ((10 , ompi_comm_output , "PMIx_Info_list_add failed %s %d" , PMIx_Error_string (rc ), __LINE__ ));
356-         return  OMPI_ERR_OUT_OF_RESOURCE  ;
358+         rc  =  OMPI_ERR_OUT_OF_RESOURCE ;
359+         goto fn_exit ;
357360    }
358361
359362    rc  =  PMIx_Info_list_convert (list , & darray );
360363    if  (PMIX_SUCCESS  !=  rc ) {
361364        OPAL_OUTPUT_VERBOSE ((10 , ompi_comm_output , "PMIx_Info_list_convert failed %s %d" , PMIx_Error_string (rc ), __LINE__ ));
362-         return  OMPI_ERR_OUT_OF_RESOURCE  ;
365+         rc  =  OMPI_ERR_OUT_OF_RESOURCE ;
366+         goto fn_exit ;
363367    }
364368    rc  =  PMIx_Info_list_add (grpinfo , PMIX_GROUP_INFO , & darray , PMIX_DATA_ARRAY );
365369    if  (PMIX_SUCCESS  !=  rc ) {
366370        OPAL_OUTPUT_VERBOSE ((10 , ompi_comm_output , "PMIx_Info_list_add failed %s %d" , PMIx_Error_string (rc ), __LINE__ ));
367-         return  OMPI_ERR_OUT_OF_RESOURCE  ;
371+         PMIX_DATA_ARRAY_DESTRUCT (& darray );
372+         rc  =  OMPI_ERR_OUT_OF_RESOURCE ;
373+         goto fn_exit ;
368374    }
369-     PMIx_Info_list_release (list );
370375    PMIX_DATA_ARRAY_DESTRUCT (& darray );
371376
372- 
373377    rc  =  PMIx_Info_list_convert (grpinfo , & darray );
374378    if  (PMIX_SUCCESS  !=  rc ) {
375379        OPAL_OUTPUT_VERBOSE ((10 , ompi_comm_output , "PMIx_Info_list_convert failed %s %d" , PMIx_Error_string (rc ), __LINE__ ));
376-         return  OMPI_ERR_OUT_OF_RESOURCE  ;
380+         rc  =  OMPI_ERR_OUT_OF_RESOURCE ;
381+         goto fn_exit ;
377382    }
378383
379384    pinfo  =  (pmix_info_t * )darray .array ;
380385    ninfo  =  darray .size ;
381-     PMIx_Info_list_release (grpinfo );
382386
383387    proc_count  =  newcomm -> c_local_group -> grp_proc_count ;
384388    if  ( OMPI_COMM_IS_INTER  (newcomm ) ){
@@ -396,10 +400,11 @@ static int ompi_comm_ext_cid_new_block (ompi_communicator_t *newcomm, ompi_commu
396400        OPAL_PMIX_CONVERT_NAME (& procs [proc_count + i ],& opal_proc_name );
397401    }
398402
403+     tproc_count  =  proc_count  +  rproc_count ;
399404
400405    OPAL_OUTPUT_VERBOSE ((10 , ompi_comm_output , "calling PMIx_Group_construct - tag %s size %ld ninfo %ld cid_base %ld\n" ,
401-                          tag , proc_count   +   rproc_count , ninfo , cid_base ));
402-     rc  =  PMIx_Group_construct (tag , procs , proc_count   +   rproc_count , pinfo , ninfo , & results , & nresults );
406+                          tag , tproc_count , ninfo , cid_base ));
407+     rc  =  PMIx_Group_construct (tag , procs , tproc_count , pinfo , ninfo , & results , & nresults );
403408    PMIX_DATA_ARRAY_DESTRUCT (& darray );
404409    if (PMIX_SUCCESS  !=  rc ) {
405410       char  msg_string [1024 ];
@@ -443,7 +448,7 @@ static int ompi_comm_ext_cid_new_block (ompi_communicator_t *newcomm, ompi_commu
443448    }
444449
445450    OPAL_OUTPUT_VERBOSE ((10 , ompi_comm_output , "PMIx_Group_construct - tag %s size %ld ninfo %ld cid_base %ld\n" ,
446-                          tag , proc_count   +   rproc_count , ninfo , cid_base ));
451+                          tag , tproc_count , ninfo , cid_base ));
447452
448453    /* destruct the group */ 
449454    rc  =  PMIx_Group_destruct  (tag , NULL , 0 );
@@ -468,10 +473,18 @@ static int ompi_comm_ext_cid_new_block (ompi_communicator_t *newcomm, ompi_commu
468473    }
469474
470475    if (NULL  !=  procs ) {
471-         PMIX_PROC_FREE (procs , proc_count );
476+         PMIX_PROC_FREE (procs , tproc_count );
472477        procs  =  NULL ;
473478    }
474479
480+     if  (NULL  !=  grpinfo ) {
481+         PMIx_Info_list_release (grpinfo );
482+     }
483+ 
484+     if  (NULL  !=  list ) {
485+         PMIx_Info_list_release (list );
486+     }
487+ 
475488    return  rc ;
476489}
477490
0 commit comments