diff --git a/src/mpi/c/comm_accept.c b/src/mpi/c/comm_accept.c index bc2e0dabbc..85434ac410 100644 --- a/src/mpi/c/comm_accept.c +++ b/src/mpi/c/comm_accept.c @@ -74,8 +74,10 @@ int MPI_Comm_accept(char *port_name, MPI_Info info, int root, * Our own port_name is not of interest here, so we pass in NULL. * The two leaders will figure this out later. However, we need the tag. */ - tmp_port = ompi_parse_port(port_name, &tag); - free (tmp_port); + if ( rank == root ) { + tmp_port = ompi_parse_port(port_name, &tag); + free (tmp_port); + } rc = ompi_comm_connect_accept (comm, root, NULL, send_first, &newcomp, tag); *newcomm = newcomp; diff --git a/src/mpi/c/comm_connect.c b/src/mpi/c/comm_connect.c index 952fce3179..991dc2d6e8 100644 --- a/src/mpi/c/comm_connect.c +++ b/src/mpi/c/comm_connect.c @@ -76,13 +76,15 @@ int MPI_Comm_connect(char *port_name, MPI_Info info, int root, * translate the port_name string into the according process_name_t * structure. */ - tmp_port = ompi_parse_port (port_name, &tag); - port_proc_name = ompi_name_server.convert_string_to_process_name(tmp_port); - if ( NULL == port_proc_name ) { - *newcomm = MPI_COMM_NULL; - return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_PORT, FUNC_NAME); + if ( rank == root ) { + tmp_port = ompi_parse_port (port_name, &tag); + port_proc_name = ompi_name_server.convert_string_to_process_name(tmp_port); + if ( NULL == port_proc_name ) { + *newcomm = MPI_COMM_NULL; + return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_PORT, FUNC_NAME); + } + free (tmp_port); } - free (tmp_port); rc = ompi_comm_connect_accept (comm, root, port_proc_name, send_first, &newcomp, tag);