1
1

fcoll/static: fix coverty warnings

fix coverty warnings CID 72144, CID 710677, CID 1364164
Этот коммит содержится в:
Edgar Gabriel 2016-07-19 07:28:50 -05:00
родитель 941d4fdb8b
Коммит a899c0fb38
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){ if (NULL == iovec_count_per_process){
opal_output (1, "OUT OF MEMORY\n"); opal_output (1, "OUT OF MEMORY\n");
ret = OMPI_ERR_OUT_OF_RESOURCE; ret = OMPI_ERR_OUT_OF_RESOURCE;
goto exit; 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){ if (NULL == displs){
opal_output (1, "OUT OF MEMORY\n"); opal_output (1, "OUT OF MEMORY\n");
ret = OMPI_ERR_OUT_OF_RESOURCE; 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){ if (NULL == iovec_count_per_process){
opal_output (1, "OUT OF MEMORY\n"); opal_output (1, "OUT OF MEMORY\n");
ret = OMPI_ERR_OUT_OF_RESOURCE; ret = OMPI_ERR_OUT_OF_RESOURCE;
goto exit; 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){ if (NULL == displs){
opal_output (1, "OUT OF MEMORY\n"); opal_output (1, "OUT OF MEMORY\n");
ret = OMPI_ERR_OUT_OF_RESOURCE; ret = OMPI_ERR_OUT_OF_RESOURCE;
@ -1050,6 +1050,11 @@ exit:
sorted = NULL; sorted = NULL;
} }
if (NULL != displs) {
free(displs);
displs = NULL;
}
return ret; return ret;
} }

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

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