Avoid malloc of zero bytes, add a check and avoid it.
This commit was SVN r28597.
Этот коммит содержится в:
родитель
2d4655a05a
Коммит
0b727f84da
@ -163,15 +163,18 @@ mca_fcoll_static_file_write_all (mca_io_ompio_file_t *fh,
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 != iov_size){
|
if (0 == iov_size){
|
||||||
local_iov_array = (local_io_array *)malloc (iov_size * sizeof(local_io_array));
|
iov_size = 1;
|
||||||
if ( NULL == local_iov_array){
|
|
||||||
fprintf(stderr,"local_iov_array allocation error\n");
|
|
||||||
ret = OMPI_ERR_OUT_OF_RESOURCE;
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local_iov_array = (local_io_array *)malloc (iov_size * sizeof(local_io_array));
|
||||||
|
if ( NULL == local_iov_array){
|
||||||
|
fprintf(stderr,"local_iov_array allocation error\n");
|
||||||
|
ret = OMPI_ERR_OUT_OF_RESOURCE;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
for (j=0; j < iov_size; j++){
|
for (j=0; j < iov_size; j++){
|
||||||
local_iov_array[j].offset = (OMPI_MPI_OFFSET_TYPE)(intptr_t)
|
local_iov_array[j].offset = (OMPI_MPI_OFFSET_TYPE)(intptr_t)
|
||||||
iov[j].iov_base;
|
iov[j].iov_base;
|
||||||
@ -324,6 +327,11 @@ mca_fcoll_static_file_write_all (mca_io_ompio_file_t *fh,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fh->f_procs_in_group[fh->f_aggregator_index] == fh->f_rank) {
|
if (fh->f_procs_in_group[fh->f_aggregator_index] == fh->f_rank) {
|
||||||
|
|
||||||
|
if ( 0 == global_iov_count){
|
||||||
|
global_iov_count = 1;
|
||||||
|
}
|
||||||
|
|
||||||
sorted = (int *)malloc (global_iov_count * sizeof(int));
|
sorted = (int *)malloc (global_iov_count * sizeof(int));
|
||||||
if (NULL == sorted) {
|
if (NULL == sorted) {
|
||||||
opal_output (1, "OUT OF MEMORY\n");
|
opal_output (1, "OUT OF MEMORY\n");
|
||||||
@ -971,6 +979,11 @@ static int local_heap_sort (local_io_array *io_array,
|
|||||||
unsigned char done = 0;
|
unsigned char done = 0;
|
||||||
int* temp_arr = NULL;
|
int* temp_arr = NULL;
|
||||||
|
|
||||||
|
if( 0 == num_entries){
|
||||||
|
num_entries = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
temp_arr = (int*)malloc(num_entries*sizeof(int));
|
temp_arr = (int*)malloc(num_entries*sizeof(int));
|
||||||
if (NULL == temp_arr) {
|
if (NULL == temp_arr) {
|
||||||
opal_output (1, "OUT OF MEMORY\n");
|
opal_output (1, "OUT OF MEMORY\n");
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user