Skip to content

Commit 47f46d1

Browse files
committed
fix coverty warnings 1322865 and 72136
1 parent 2b744c2 commit 47f46d1

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

ompi/mca/fcoll/dynamic/fcoll_dynamic_file_write_all.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,6 +1063,11 @@ exit :
10631063
}
10641064

10651065
}
1066+
1067+
if (NULL != displs){
1068+
free(displs);
1069+
displs=NULL;
1070+
}
10661071

10671072
if (! sendbuf_is_contiguous) {
10681073
if (NULL != send_buf) {

ompi/mca/fcoll/static/fcoll_static_file_read_all.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -385,15 +385,12 @@ mca_fcoll_static_file_read_all (mca_io_ompio_file_t *fh,
385385
goto exit;
386386
}
387387

388-
if (NULL == sendtype){
389-
sendtype = (ompi_datatype_t **) malloc (fh->f_procs_per_group * sizeof(ompi_datatype_t *));
390-
if (NULL == sendtype) {
391-
opal_output (1, "OUT OF MEMORY\n");
392-
ret = OMPI_ERR_OUT_OF_RESOURCE;
393-
goto exit;
394-
}
388+
sendtype = (ompi_datatype_t **) malloc (fh->f_procs_per_group * sizeof(ompi_datatype_t *));
389+
if (NULL == sendtype) {
390+
opal_output (1, "OUT OF MEMORY\n");
391+
ret = OMPI_ERR_OUT_OF_RESOURCE;
392+
goto exit;
395393
}
396-
397394
for ( i=0; i<fh->f_procs_per_group; i++ ) {
398395
sendtype[i] = MPI_DATATYPE_NULL;
399396
}
@@ -450,11 +447,13 @@ mca_fcoll_static_file_read_all (mca_io_ompio_file_t *fh,
450447
free(memory_displacements);
451448
memory_displacements= NULL;
452449
}
453-
454-
for ( i=0; i<fh->f_procs_per_group; i++ ) {
455-
if ( MPI_DATATYPE_NULL != sendtype[i] ) {
456-
ompi_datatype_destroy (&sendtype[i] );
457-
sendtype[i] = MPI_DATATYPE_NULL;
450+
451+
if ( NULL != sendtype ) {
452+
for ( i=0; i<fh->f_procs_per_group; i++ ) {
453+
if ( MPI_DATATYPE_NULL != sendtype[i] ) {
454+
ompi_datatype_destroy (&sendtype[i] );
455+
sendtype[i] = MPI_DATATYPE_NULL;
456+
}
458457
}
459458
}
460459

0 commit comments

Comments
 (0)