1
1

Ensure we don't segfault if comm_spawn_multiple fails as it returns a NULL pointer to the new communicator when that happens. Thanks to Yuki MATSUMOTO of Fujitsu for the patch.

cmr:v1.6

This commit was SVN r25886.
Этот коммит содержится в:
Ralph Castain 2012-02-09 15:59:49 +00:00
родитель 6dde3b6d86
Коммит 30ab3b2332

Просмотреть файл

@ -44,7 +44,7 @@ int MPI_Comm_spawn_multiple(int count, char **array_of_commands, char ***array_o
int root, MPI_Comm comm, MPI_Comm *intercomm,
int *array_of_errcodes)
{
int i=0, rc=0, rank=0, flag;
int i=0, rc=0, rank=0, size=0, flag;
ompi_communicator_t *newcomp=NULL;
bool send_first=false; /* they are contacting us first */
char port_name[MPI_MAX_PORT_NAME];
@ -177,8 +177,18 @@ error:
/* set array of errorcodes */
if (MPI_ERRCODES_IGNORE != array_of_errcodes) {
for ( i=0; i < newcomp->c_remote_group->grp_proc_count; i++ ) {
array_of_errcodes[i]=rc;
if (NULL != newcomp) {
for ( i=0; i < newcomp->c_remote_group->grp_proc_count; i++ ) {
array_of_errcodes[i]=rc;
}
} else {
for ( i=0; i < count; i++) {
size = size + array_of_maxprocs[i];
}
for ( i=0; i < size; i++) {
array_of_errcodes[i]=rc;
}
}
}