@@ -639,10 +639,9 @@ PREFIX (num_images)(int distance __attribute__ ((unused)),
639
639
int communicator_shrink (MPI_Comm * comm )
640
640
{
641
641
int ns ,srank ,crank ,rc ,flag ,i ,drank ,nc ,nd ;
642
- MPI_Comm shrunk , * newcomm ;
642
+ MPI_Comm shrunk , newcomm ;
643
643
MPI_Group cgrp , sgrp , dgrp ;
644
644
645
- newcomm = (MPI_Comm * )calloc (1 ,sizeof (MPI_Comm ));
646
645
redo :
647
646
MPIX_Comm_shrink (* comm , & shrunk );
648
647
MPI_Comm_set_errhandler ( shrunk , errh );
@@ -654,7 +653,7 @@ int communicator_shrink(MPI_Comm *comm)
654
653
* so that all surviving processes remain at their former place */
655
654
if (img_status == STAT_STOPPED_IMAGE )
656
655
crank = -1 ;
657
- rc = MPI_Comm_split (shrunk , crank < 0 ?MPI_UNDEFINED :1 , crank , newcomm );
656
+ rc = MPI_Comm_split (shrunk , crank < 0 ?MPI_UNDEFINED :1 , crank , & newcomm );
658
657
flag = (rc == MPI_SUCCESS );
659
658
/* Split or some of the communications above may have failed if
660
659
* new failures have disrupted the process: we need to
@@ -663,10 +662,10 @@ int communicator_shrink(MPI_Comm *comm)
663
662
664
663
MPI_Comm_free (& shrunk );
665
664
if ( MPI_SUCCESS != flag ) {
666
- if ( MPI_SUCCESS == rc ) MPI_Comm_free (* newcomm );
665
+ if ( MPI_SUCCESS == rc ) MPI_Comm_free (newcomm );
667
666
goto redo ;
668
667
}
669
- * comm = * newcomm ;
668
+ * comm = newcomm ;
670
669
return MPI_SUCCESS ;
671
670
}
672
671
0 commit comments