From 6f2e8d20737907b474a401d041b5c0b1059e7d3f Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Tue, 25 Aug 2015 08:46:38 -0500 Subject: [PATCH] last nights coverty fix introduced a new coverty complain. This commit tries to fix the new complain by coverty. --- .../mca/fcoll/dynamic/fcoll_dynamic_file_read_all.c | 13 +++++++++---- .../fcoll/dynamic/fcoll_dynamic_file_write_all.c | 12 +++++++++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_read_all.c b/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_read_all.c index 8a1d4713c3..8c9e66038c 100644 --- a/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_read_all.c +++ b/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_read_all.c @@ -350,7 +350,7 @@ } for(l=0;lf_procs_per_group;l++){ - + sendtype[l] = MPI_DATATYPE_NULL; disp_index[l] = 1; if (NULL != blocklen_per_process[l]){ @@ -804,8 +804,11 @@ free (global_buf); global_buf = NULL; } - for (i = 0; i < fh->f_procs_per_group; i++) - ompi_datatype_destroy(sendtype+i); + for (i = 0; i < fh->f_procs_per_group; i++) { + if ( MPI_DATATYPE_NULL != sendtype[i] ){ + ompi_datatype_destroy(&sendtype[i]); + } + } if (NULL != sendtype){ free(sendtype); sendtype=NULL; @@ -902,7 +905,9 @@ } if (NULL != sendtype){ for (i = 0; i < fh->f_procs_per_group; i++) { - ompi_datatype_destroy(sendtype+i); + if ( MPI_DATATYPE_NULL != sendtype[i] ) { + ompi_datatype_destroy(&sendtype[i]); + } } free(sendtype); sendtype=NULL; diff --git a/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_write_all.c b/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_write_all.c index 2e0b35b7ce..3efcd37b82 100644 --- a/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_write_all.c +++ b/ompi/mca/fcoll/dynamic/fcoll_dynamic_file_write_all.c @@ -372,6 +372,7 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh, } for(l=0;lf_procs_per_group;l++){ + recvtype[i] = MPI_DATATYPE_NULL; disp_index[l] = 1; if (NULL != blocklen_per_process[l]){ @@ -952,9 +953,12 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh, free (fh->f_io_array); fh->f_io_array = NULL; } - for (i =0; i< fh->f_procs_per_group; i++) - ompi_datatype_destroy(recvtype+i); if (NULL != recvtype){ + for (i =0; i< fh->f_procs_per_group; i++) { + if ( MPI_DATATYPE_NULL != recvtype[i] ) { + ompi_datatype_destroy(&recvtype[i]); + } + } free(recvtype); recvtype=NULL; } @@ -1006,7 +1010,9 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh, } if (NULL != recvtype){ for (i =0; i< fh->f_procs_per_group; i++) { - ompi_datatype_destroy(recvtype+i); + if ( MPI_DATATYPE_NULL != recvtype[i] ) { + ompi_datatype_destroy(&recvtype[i]); + } } free(recvtype); recvtype=NULL;