1
1

Merge pull request #1882 from edgargabriel/pr/coverty-fixes

fcoll/static and io/ompio: fix coverty warnings
Этот коммит содержится в:
Edgar Gabriel 2016-07-21 16:12:15 -05:00 коммит произвёл GitHub
родитель 941d4fdb8b a899c0fb38
Коммит 2170eee5b7
3 изменённых файлов: 38 добавлений и 29 удалений

Просмотреть файл

@ -275,14 +275,14 @@ mca_fcoll_static_file_read_all (mca_io_ompio_file_t *fh,
}
iovec_count_per_process = (int *) malloc (fh->f_procs_per_group * sizeof(int));
iovec_count_per_process = (int *) calloc (fh->f_procs_per_group, sizeof(int));
if (NULL == iovec_count_per_process){
opal_output (1, "OUT OF MEMORY\n");
ret = OMPI_ERR_OUT_OF_RESOURCE;
goto exit;
}
displs = (int *) malloc (fh->f_procs_per_group * sizeof(int));
displs = (int *) calloc (fh->f_procs_per_group, sizeof(int));
if (NULL == displs){
opal_output (1, "OUT OF MEMORY\n");
ret = OMPI_ERR_OUT_OF_RESOURCE;

Просмотреть файл

@ -278,14 +278,14 @@ mca_fcoll_static_file_write_all (mca_io_ompio_file_t *fh,
}
}
iovec_count_per_process = (int *) malloc (fh->f_procs_per_group * sizeof(int));
iovec_count_per_process = (int *) calloc (fh->f_procs_per_group, sizeof(int));
if (NULL == iovec_count_per_process){
opal_output (1, "OUT OF MEMORY\n");
ret = OMPI_ERR_OUT_OF_RESOURCE;
goto exit;
}
displs = (int *) malloc (fh->f_procs_per_group * sizeof(int));
displs = (int *) calloc (fh->f_procs_per_group, sizeof(int));
if (NULL == displs){
opal_output (1, "OUT OF MEMORY\n");
ret = OMPI_ERR_OUT_OF_RESOURCE;
@ -1050,6 +1050,11 @@ exit:
sorted = NULL;
}
if (NULL != displs) {
free(displs);
displs = NULL;
}
return ret;
}

Просмотреть файл

@ -1864,7 +1864,7 @@ int mca_io_ompio_merge_groups(mca_io_ompio_file_t *fh,
{
int i = 0;
int *sizes_old_group;
int ret = OMPI_SUCCESS;
int *displs;
@ -1886,17 +1886,22 @@ int mca_io_ompio_merge_groups(mca_io_ompio_file_t *fh,
//merge_aggrs[0] is considered the new aggregator
//New aggregator collects group sizes of the groups to be merged
fcoll_base_coll_allgather_array (&fh->f_init_procs_per_group,
1,
MPI_INT,
sizes_old_group,
1,
MPI_INT,
0,
merge_aggrs,
num_merge_aggrs,
fh->f_comm);
ret = fcoll_base_coll_allgather_array (&fh->f_init_procs_per_group,
1,
MPI_INT,
sizes_old_group,
1,
MPI_INT,
0,
merge_aggrs,
num_merge_aggrs,
fh->f_comm);
if ( OMPI_SUCCESS != ret ) {
free (displs);
free (sizes_old_group);
return ret;
}
fh->f_procs_per_group = 0;
@ -1920,23 +1925,22 @@ int mca_io_ompio_merge_groups(mca_io_ompio_file_t *fh,
//New aggregator also collects the grouping distribution
//This is the actual merge
//use allgatherv array
fcoll_base_coll_allgatherv_array (fh->f_init_procs_in_group,
fh->f_init_procs_per_group,
MPI_INT,
fh->f_procs_in_group,
sizes_old_group,
displs,
MPI_INT,
0,
merge_aggrs,
num_merge_aggrs,
fh->f_comm);
ret = fcoll_base_coll_allgatherv_array (fh->f_init_procs_in_group,
fh->f_init_procs_per_group,
MPI_INT,
fh->f_procs_in_group,
sizes_old_group,
displs,
MPI_INT,
0,
merge_aggrs,
num_merge_aggrs,
fh->f_comm);
free(displs);
free (displs);
free (sizes_old_group);
return OMPI_SUCCESS;
return ret;
}