From 72f6cf2e4f1e8219bd3362102ebb8910f80161eb Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Mon, 25 Oct 2004 20:20:07 +0000 Subject: [PATCH] Ensure that attributes that copy to fail will return an error out of MPI_COMM_DUP. This commit was SVN r3319. --- src/communicator/comm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/communicator/comm.c b/src/communicator/comm.c index 297773fe02..f7a74575d9 100644 --- a/src/communicator/comm.c +++ b/src/communicator/comm.c @@ -165,13 +165,18 @@ int ompi_comm_set ( ompi_communicator_t *newcomm, if (NULL != oldcomm->c_keyhash) { if (NULL != attr) { ompi_attr_hash_init(&newcomm->c_keyhash); - ompi_attr_copy_all (COMM_ATTR, oldcomm, newcomm, attr, - newcomm->c_keyhash); + if (OMPI_SUCCESS != (ret = ompi_attr_copy_all (COMM_ATTR, oldcomm, + newcomm, attr, + newcomm->c_keyhash))) { + OBJ_RELEASE(newcomm); + return ret; + } } } /* Initialize the PML stuff in the newcomm */ if ( OMPI_ERROR == mca_pml.pml_add_comm(newcomm) ) { + OBJ_RELEASE(newcomm); return OMPI_ERROR; } return (OMPI_SUCCESS);