[mpich2-commits] r5605 - mpich2/trunk/src/mpi/errhan
goodell at mcs.anl.gov
goodell at mcs.anl.gov
Wed Oct 28 18:24:44 CDT 2009
Author: goodell
Date: 2009-10-28 18:24:44 -0500 (Wed, 28 Oct 2009)
New Revision: 5605
Modified:
mpich2/trunk/src/mpi/errhan/comm_set_errhandler.c
mpich2/trunk/src/mpi/errhan/win_set_errhandler.c
Log:
Fix MPI_Comm/MPI_Win errhandler leak.
Prior to this commit we only released references to previously set comm
and win errhandlers in MPI_{Comm,Win}_set_errhandler if the newly set
errhandler was *not* builtin. This resulted in an errhandler object
leak if a user-defined errhandler was set and then a predefined
errhandler was set afterwards.
Reviewed by buntinas at .
Modified: mpich2/trunk/src/mpi/errhan/comm_set_errhandler.c
===================================================================
--- mpich2/trunk/src/mpi/errhan/comm_set_errhandler.c 2009-10-28 23:24:42 UTC (rev 5604)
+++ mpich2/trunk/src/mpi/errhan/comm_set_errhandler.c 2009-10-28 23:24:44 UTC (rev 5605)
@@ -97,19 +97,17 @@
# endif /* HAVE_ERROR_CHECKING */
/* ... body of routine ... */
-
+
/* We don't bother with the case where the errhandler is NULL;
in this case, the error handler was the original, MPI_ERRORS_ARE_FATAL,
which is builtin and can never be freed. */
if (comm_ptr->errhandler != NULL) {
- if (HANDLE_GET_KIND(errhandler) != HANDLE_KIND_BUILTIN) {
- MPIR_Errhandler_release_ref(comm_ptr->errhandler,&in_use);
- if (!in_use) {
- MPID_Errhandler_free( comm_ptr->errhandler );
- }
- }
+ MPIR_Errhandler_release_ref(comm_ptr->errhandler,&in_use);
+ if (!in_use) {
+ MPID_Errhandler_free( comm_ptr->errhandler );
+ }
}
-
+
MPIR_Errhandler_add_ref(errhan_ptr);
comm_ptr->errhandler = errhan_ptr;
Modified: mpich2/trunk/src/mpi/errhan/win_set_errhandler.c
===================================================================
--- mpich2/trunk/src/mpi/errhan/win_set_errhandler.c 2009-10-28 23:24:42 UTC (rev 5604)
+++ mpich2/trunk/src/mpi/errhan/win_set_errhandler.c 2009-10-28 23:24:44 UTC (rev 5605)
@@ -102,19 +102,17 @@
# endif /* HAVE_ERROR_CHECKING */
/* ... body of routine ... */
-
+
if (win_ptr->errhandler != NULL) {
- if (HANDLE_GET_KIND(errhandler) != HANDLE_KIND_BUILTIN) {
- MPIR_Errhandler_release_ref(win_ptr->errhandler,&in_use);
- if (!in_use) {
- MPID_Errhandler_free( win_ptr->errhandler );
- }
- }
+ MPIR_Errhandler_release_ref(win_ptr->errhandler,&in_use);
+ if (!in_use) {
+ MPID_Errhandler_free( win_ptr->errhandler );
+ }
}
-
+
MPIR_Errhandler_add_ref(errhan_ptr);
win_ptr->errhandler = errhan_ptr;
-
+
/* ... end of body of routine ... */
#ifdef HAVE_ERROR_CHECKING
More information about the mpich2-commits
mailing list