@@ -121,10 +121,10 @@ int ompi_comm_set ( ompi_communicator_t **ncomm,
121121 }
122122
123123 if (NULL != req ) {
124- ompi_request_wait ( & req , MPI_STATUS_IGNORE );
124+ rc = ompi_request_wait ( & req , MPI_STATUS_IGNORE );
125125 }
126126
127- return OMPI_SUCCESS ;
127+ return rc ;
128128}
129129
130130/*
@@ -1007,6 +1007,7 @@ int ompi_comm_dup_with_info ( ompi_communicator_t * comm, opal_info_t *info, omp
10071007 /* Determine context id. It is identical to f_2_c_handle */
10081008 rc = ompi_comm_nextcid (newcomp , comm , NULL , NULL , NULL , false, mode );
10091009 if ( OMPI_SUCCESS != rc ) {
1010+ OBJ_RELEASE (newcomp );
10101011 return rc ;
10111012 }
10121013
@@ -1023,6 +1024,7 @@ int ompi_comm_dup_with_info ( ompi_communicator_t * comm, opal_info_t *info, omp
10231024 /* activate communicator and init coll-module */
10241025 rc = ompi_comm_activate (& newcomp , comm , NULL , NULL , NULL , false, mode );
10251026 if ( OMPI_SUCCESS != rc ) {
1027+ OBJ_RELEASE (newcomp );
10261028 return rc ;
10271029 }
10281030
@@ -1139,6 +1141,7 @@ static int ompi_comm_idup_getcid (ompi_comm_request_t *request)
11391141 NULL , false, mode , subreq );
11401142 if (OMPI_SUCCESS != rc ) {
11411143 ompi_comm_request_return (request );
1144+ OBJ_RELEASE (context -> newcomp );
11421145 return rc ;
11431146 }
11441147
@@ -1167,6 +1170,7 @@ static int ompi_comm_idup_with_info_activate (ompi_comm_request_t *request)
11671170 /* activate communicator and init coll-module */
11681171 rc = ompi_comm_activate_nb (& context -> newcomp , context -> comm , NULL , NULL , NULL , false, mode , subreq );
11691172 if ( OMPI_SUCCESS != rc ) {
1173+ OBJ_RELEASE (context -> newcomp );
11701174 return rc ;
11711175 }
11721176
@@ -1209,6 +1213,7 @@ int ompi_comm_create_group (ompi_communicator_t *comm, ompi_group_t *group, int
12091213 /* Determine context id. It is identical to f_2_c_handle */
12101214 rc = ompi_comm_nextcid (newcomp , comm , NULL , & tag , NULL , false, mode );
12111215 if ( OMPI_SUCCESS != rc ) {
1216+ OBJ_RELEASE (newcomp );
12121217 return rc ;
12131218 }
12141219
@@ -1219,6 +1224,7 @@ int ompi_comm_create_group (ompi_communicator_t *comm, ompi_group_t *group, int
12191224 /* activate communicator and init coll-module */
12201225 rc = ompi_comm_activate (& newcomp , comm , NULL , & tag , NULL , false, mode );
12211226 if ( OMPI_SUCCESS != rc ) {
1227+ OBJ_RELEASE (newcomp );
12221228 return rc ;
12231229 }
12241230
@@ -1516,16 +1522,16 @@ int ompi_comm_free( ompi_communicator_t **comm )
15161522/**********************************************************************/
15171523/**********************************************************************/
15181524/**********************************************************************/
1519- ompi_proc_t * * ompi_comm_get_rprocs ( ompi_communicator_t * local_comm ,
1520- ompi_communicator_t * bridge_comm ,
1521- int local_leader ,
1522- int remote_leader ,
1523- int tag ,
1524- int rsize )
1525+ int ompi_comm_get_rprocs ( ompi_communicator_t * local_comm ,
1526+ ompi_communicator_t * bridge_comm ,
1527+ int local_leader ,
1528+ int remote_leader ,
1529+ int tag ,
1530+ int rsize ,
1531+ ompi_proc_t * * * prprocs )
15251532{
1526-
15271533 MPI_Request req ;
1528- int rc ;
1534+ int rc = OMPI_SUCCESS ;
15291535 int local_rank , local_size ;
15301536 ompi_proc_t * * rprocs = NULL ;
15311537 int32_t size_len ;
@@ -1542,7 +1548,7 @@ ompi_proc_t **ompi_comm_get_rprocs ( ompi_communicator_t *local_comm,
15421548 if (local_rank == local_leader ) {
15431549 sbuf = OBJ_NEW (opal_buffer_t );
15441550 if (NULL == sbuf ) {
1545- rc = OMPI_ERROR ;
1551+ rc = OMPI_ERR_OUT_OF_RESOURCE ;
15461552 goto err_exit ;
15471553 }
15481554 if (OMPI_GROUP_IS_DENSE (local_comm -> c_local_group )) {
@@ -1594,6 +1600,7 @@ ompi_proc_t **ompi_comm_get_rprocs ( ompi_communicator_t *local_comm,
15941600 /* Allocate temporary buffer */
15951601 recvbuf = (char * )malloc (rlen );
15961602 if ( NULL == recvbuf ) {
1603+ rc = OMPI_ERR_OUT_OF_RESOURCE ;
15971604 goto err_exit ;
15981605 }
15991606
@@ -1625,19 +1632,20 @@ ompi_proc_t **ompi_comm_get_rprocs ( ompi_communicator_t *local_comm,
16251632
16261633 rbuf = OBJ_NEW (opal_buffer_t );
16271634 if (NULL == rbuf ) {
1628- rc = OMPI_ERROR ;
1635+ rc = OMPI_ERR_OUT_OF_RESOURCE ;
16291636 goto err_exit ;
16301637 }
16311638
16321639 if (OMPI_SUCCESS != (rc = opal_dss .load (rbuf , recvbuf , rlen ))) {
16331640 goto err_exit ;
16341641 }
16351642
1636- /* decode the names into a proc-list */
1643+ /* decode the names into a proc-list -- will never add a new proc
1644+ as the result of this operation, so no need to get the newprocs
1645+ list or call PML add_procs(). */
16371646 rc = ompi_proc_unpack (rbuf , rsize , & rprocs , NULL , NULL );
16381647 OBJ_RELEASE (rbuf );
16391648 if (OMPI_SUCCESS != rc ) {
1640- OMPI_ERROR_LOG (rc );
16411649 goto err_exit ;
16421650 }
16431651
@@ -1657,14 +1665,14 @@ ompi_proc_t **ompi_comm_get_rprocs ( ompi_communicator_t *local_comm,
16571665
16581666 /* And now add the information into the database */
16591667 if (OMPI_SUCCESS != (rc = MCA_PML_CALL (add_procs (rprocs , rsize )))) {
1660- OMPI_ERROR_LOG (rc );
16611668 goto err_exit ;
16621669 }
16631670
16641671 err_exit :
16651672 /* rprocs isn't freed unless we have an error,
16661673 since it is used in the communicator */
16671674 if ( OMPI_SUCCESS != rc ) {
1675+ OMPI_ERROR_LOG (rc );
16681676 opal_output (0 , "%d: Error in ompi_get_rprocs\n" , local_rank );
16691677 if ( NULL != rprocs ) {
16701678 free ( rprocs );
@@ -1685,7 +1693,8 @@ ompi_proc_t **ompi_comm_get_rprocs ( ompi_communicator_t *local_comm,
16851693 free ( sendbuf );
16861694 }
16871695
1688- return rprocs ;
1696+ * prprocs = rprocs ;
1697+ return rc ;
16891698}
16901699/**********************************************************************/
16911700/**********************************************************************/
0 commit comments