From cb861f8f1c82ebe7f3d9934b3fd7a2447b9235c7 Mon Sep 17 00:00:00 2001 From: Mark Stillwell Date: Fri, 14 Oct 2011 17:01:30 +0200 Subject: [PATCH] fixed minor bug where the Fortran compatibility layer wasn't checking to see if an object was present before trying to look it up in a dynamic array. --- src/smpi/smpi_f77.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/smpi/smpi_f77.c b/src/smpi/smpi_f77.c index 2f84829faf..de9bc89532 100644 --- a/src/smpi/smpi_f77.c +++ b/src/smpi/smpi_f77.c @@ -28,7 +28,7 @@ static int new_comm(MPI_Comm comm) { static MPI_Comm get_comm(int comm) { if(comm == -2) { return MPI_COMM_SELF; - } else if(comm >= 0) { + } else if(comm_lookup && comm >= 0 && comm < (int)xbt_dynar_length(comm_lookup)) { return *(MPI_Comm*)xbt_dynar_get_ptr(comm_lookup, comm); } return MPI_COMM_NULL; @@ -123,9 +123,13 @@ void mpi_init__(int* ierr) { void mpi_finalize__(int* ierr) { *ierr = MPI_Finalize(); xbt_dynar_free(&op_lookup); + op_lookup = NULL; xbt_dynar_free(&datatype_lookup); + datatype_lookup = NULL; xbt_dict_free(&request_lookup); + request_lookup = NULL; xbt_dynar_free(&comm_lookup); + comm_lookup = NULL; } void mpi_abort__(int* comm, int* errorcode, int* ierr) { -- 2.20.1