1
1

fix CID 1349739, CID 1349738, CID 1349736 and (probably) CID 1349740 (not entirely sure about the last one, since I don't understand why block[i] is a problem but max_len[i] allocated and treated exactly the same way 1 line later is not).

Этот коммит содержится в:
Edgar Gabriel 2016-01-21 08:30:19 -06:00
родитель 655b4be97c
Коммит b253d4e887

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

@ -559,8 +559,10 @@ exit :
free(broken_total_lengths); free(broken_total_lengths);
free(broken_iov_counts); free(broken_iov_counts);
free(broken_decoded_iovs); // decoded_iov arrays[i] were freed as aggr_data[i]->decoded_iov; free(broken_decoded_iovs); // decoded_iov arrays[i] were freed as aggr_data[i]->decoded_iov;
for (i=0; i<dynamic_gen2_num_io_procs; i++ ) { if ( NULL != broken_iov_arrays ) {
free(broken_iov_arrays[i]); for (i=0; i<dynamic_gen2_num_io_procs; i++ ) {
free(broken_iov_arrays[i]);
}
} }
free(broken_iov_arrays); free(broken_iov_arrays);
free(aggregators); free(aggregators);
@ -1132,8 +1134,8 @@ int mca_fcoll_dynamic_gen2_break_file_view ( struct iovec *mem_iov, int mem_coun
goto exit; goto exit;
} }
for ( i=0; i<stripe_count; i++ ) { for ( i=0; i<stripe_count; i++ ) {
broken_mem_iovs[i] = (struct iovec*) malloc (sizeof(struct iovec )); broken_mem_iovs[i] = (struct iovec*) calloc (1, sizeof(struct iovec ));
broken_file_iovs[i] = (struct iovec*) malloc (sizeof(struct iovec )); broken_file_iovs[i] = (struct iovec*) calloc (1, sizeof(struct iovec ));
} }
broken_mem_counts = (int *) calloc ( stripe_count, sizeof(int)); broken_mem_counts = (int *) calloc ( stripe_count, sizeof(int));
@ -1145,8 +1147,8 @@ int mca_fcoll_dynamic_gen2_break_file_view ( struct iovec *mem_iov, int mem_coun
goto exit; goto exit;
} }
block = (int **) malloc ( stripe_count * sizeof(int *)); block = (int **) calloc ( stripe_count, sizeof(int *));
max_lengths = (int **) malloc ( stripe_count * sizeof(int *)); max_lengths = (int **) calloc ( stripe_count, sizeof(int *));
if ( NULL == block || NULL == max_lengths ) { if ( NULL == block || NULL == max_lengths ) {
ret = OMPI_ERR_OUT_OF_RESOURCE; ret = OMPI_ERR_OUT_OF_RESOURCE;
goto exit; goto exit;
@ -1168,8 +1170,8 @@ int mca_fcoll_dynamic_gen2_break_file_view ( struct iovec *mem_iov, int mem_coun
} }
/* Step 1: separate the local_iov_array per aggregator */ /* Step 1: separate the local_iov_array per aggregator */
int owner, rest, len, temp_len, blocklen, memlen; int owner, rest, len, temp_len, blocklen, memlen=0;
off_t offset, temp_offset, start_offset, memoffset; off_t offset, temp_offset, start_offset, memoffset=0;
i=j=0; i=j=0;