@@ -120,10 +120,10 @@ int ompi_comm_set ( ompi_communicator_t **ncomm,
120120 }
121121
122122 if (NULL != req ) {
123- ompi_request_wait ( & req , MPI_STATUS_IGNORE );
123+ rc = ompi_request_wait ( & req , MPI_STATUS_IGNORE );
124124 }
125125
126- return OMPI_SUCCESS ;
126+ return rc ;
127127}
128128
129129/*
@@ -1006,6 +1006,7 @@ int ompi_comm_dup_with_info ( ompi_communicator_t * comm, opal_info_t *info, omp
10061006 /* Determine context id. It is identical to f_2_c_handle */
10071007 rc = ompi_comm_nextcid (newcomp , comm , NULL , NULL , NULL , false, mode );
10081008 if ( OMPI_SUCCESS != rc ) {
1009+ OBJ_RELEASE (newcomp );
10091010 return rc ;
10101011 }
10111012
@@ -1022,6 +1023,7 @@ int ompi_comm_dup_with_info ( ompi_communicator_t * comm, opal_info_t *info, omp
10221023 /* activate communicator and init coll-module */
10231024 rc = ompi_comm_activate (& newcomp , comm , NULL , NULL , NULL , false, mode );
10241025 if ( OMPI_SUCCESS != rc ) {
1026+ OBJ_RELEASE (newcomp );
10251027 return rc ;
10261028 }
10271029
@@ -1138,6 +1140,7 @@ static int ompi_comm_idup_getcid (ompi_comm_request_t *request)
11381140 NULL , false, mode , subreq );
11391141 if (OMPI_SUCCESS != rc ) {
11401142 ompi_comm_request_return (request );
1143+ OBJ_RELEASE (context -> newcomp );
11411144 return rc ;
11421145 }
11431146
@@ -1166,6 +1169,7 @@ static int ompi_comm_idup_with_info_activate (ompi_comm_request_t *request)
11661169 /* activate communicator and init coll-module */
11671170 rc = ompi_comm_activate_nb (& context -> newcomp , context -> comm , NULL , NULL , NULL , false, mode , subreq );
11681171 if ( OMPI_SUCCESS != rc ) {
1172+ OBJ_RELEASE (context -> newcomp );
11691173 return rc ;
11701174 }
11711175
@@ -1208,6 +1212,7 @@ int ompi_comm_create_group (ompi_communicator_t *comm, ompi_group_t *group, int
12081212 /* Determine context id. It is identical to f_2_c_handle */
12091213 rc = ompi_comm_nextcid (newcomp , comm , NULL , & tag , NULL , false, mode );
12101214 if ( OMPI_SUCCESS != rc ) {
1215+ OBJ_RELEASE (newcomp );
12111216 return rc ;
12121217 }
12131218
@@ -1218,6 +1223,7 @@ int ompi_comm_create_group (ompi_communicator_t *comm, ompi_group_t *group, int
12181223 /* activate communicator and init coll-module */
12191224 rc = ompi_comm_activate (& newcomp , comm , NULL , & tag , NULL , false, mode );
12201225 if ( OMPI_SUCCESS != rc ) {
1226+ OBJ_RELEASE (newcomp );
12211227 return rc ;
12221228 }
12231229
@@ -1517,16 +1523,16 @@ int ompi_comm_free( ompi_communicator_t **comm )
15171523/**********************************************************************/
15181524/**********************************************************************/
15191525/**********************************************************************/
1520- ompi_proc_t * * ompi_comm_get_rprocs ( ompi_communicator_t * local_comm ,
1521- ompi_communicator_t * bridge_comm ,
1522- int local_leader ,
1523- int remote_leader ,
1524- int tag ,
1525- int rsize )
1526+ int ompi_comm_get_rprocs ( ompi_communicator_t * local_comm ,
1527+ ompi_communicator_t * bridge_comm ,
1528+ int local_leader ,
1529+ int remote_leader ,
1530+ int tag ,
1531+ int rsize ,
1532+ ompi_proc_t * * * prprocs )
15261533{
1527-
15281534 MPI_Request req ;
1529- int rc ;
1535+ int rc = OMPI_SUCCESS ;
15301536 int local_rank , local_size ;
15311537 ompi_proc_t * * rprocs = NULL ;
15321538 int32_t size_len ;
@@ -1543,7 +1549,7 @@ ompi_proc_t **ompi_comm_get_rprocs ( ompi_communicator_t *local_comm,
15431549 if (local_rank == local_leader ) {
15441550 sbuf = OBJ_NEW (opal_buffer_t );
15451551 if (NULL == sbuf ) {
1546- rc = OMPI_ERROR ;
1552+ rc = OMPI_ERR_OUT_OF_RESOURCE ;
15471553 goto err_exit ;
15481554 }
15491555 if (OMPI_GROUP_IS_DENSE (local_comm -> c_local_group )) {
@@ -1595,6 +1601,7 @@ ompi_proc_t **ompi_comm_get_rprocs ( ompi_communicator_t *local_comm,
15951601 /* Allocate temporary buffer */
15961602 recvbuf = (char * )malloc (rlen );
15971603 if ( NULL == recvbuf ) {
1604+ rc = OMPI_ERR_OUT_OF_RESOURCE ;
15981605 goto err_exit ;
15991606 }
16001607
@@ -1626,19 +1633,20 @@ ompi_proc_t **ompi_comm_get_rprocs ( ompi_communicator_t *local_comm,
16261633
16271634 rbuf = OBJ_NEW (opal_buffer_t );
16281635 if (NULL == rbuf ) {
1629- rc = OMPI_ERROR ;
1636+ rc = OMPI_ERR_OUT_OF_RESOURCE ;
16301637 goto err_exit ;
16311638 }
16321639
16331640 if (OMPI_SUCCESS != (rc = opal_dss .load (rbuf , recvbuf , rlen ))) {
16341641 goto err_exit ;
16351642 }
16361643
1637- /* decode the names into a proc-list */
1644+ /* decode the names into a proc-list -- will never add a new proc
1645+ as the result of this operation, so no need to get the newprocs
1646+ list or call PML add_procs(). */
16381647 rc = ompi_proc_unpack (rbuf , rsize , & rprocs , NULL , NULL );
16391648 OBJ_RELEASE (rbuf );
16401649 if (OMPI_SUCCESS != rc ) {
1641- OMPI_ERROR_LOG (rc );
16421650 goto err_exit ;
16431651 }
16441652
@@ -1658,14 +1666,14 @@ ompi_proc_t **ompi_comm_get_rprocs ( ompi_communicator_t *local_comm,
16581666
16591667 /* And now add the information into the database */
16601668 if (OMPI_SUCCESS != (rc = MCA_PML_CALL (add_procs (rprocs , rsize )))) {
1661- OMPI_ERROR_LOG (rc );
16621669 goto err_exit ;
16631670 }
16641671
16651672 err_exit :
16661673 /* rprocs isn't freed unless we have an error,
16671674 since it is used in the communicator */
16681675 if ( OMPI_SUCCESS != rc ) {
1676+ OMPI_ERROR_LOG (rc );
16691677 opal_output (0 , "%d: Error in ompi_get_rprocs\n" , local_rank );
16701678 if ( NULL != rprocs ) {
16711679 free ( rprocs );
@@ -1686,7 +1694,8 @@ ompi_proc_t **ompi_comm_get_rprocs ( ompi_communicator_t *local_comm,
16861694 free ( sendbuf );
16871695 }
16881696
1689- return rprocs ;
1697+ * prprocs = rprocs ;
1698+ return rc ;
16901699}
16911700/**********************************************************************/
16921701/**********************************************************************/
0 commit comments