1
1

correctly free some arrays in case of an error. This fixes a whole bunch of coverty warnings.

Этот коммит содержится в:
Edgar Gabriel 2015-08-24 14:13:37 -05:00
родитель b4fcd3897e
Коммит db2d37ad93
2 изменённых файлов: 60 добавлений и 0 удалений

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

@ -851,6 +851,16 @@
#endif
exit:
if (!(fh->f_flags & OMPIO_CONTIGUOUS_MEMORY)) {
if (NULL != receive_buf) {
free (receive_buf);
receive_buf = NULL;
}
}
if (NULL != global_buf) {
free (global_buf);
global_buf = NULL;
}
if (NULL != sorted) {
free (sorted);
sorted = NULL;
@ -878,6 +888,26 @@
}
if (fh->f_procs_in_group[fh->f_aggregator_index] == fh->f_rank) {
if (NULL != sorted_file_offsets){
free(sorted_file_offsets);
sorted_file_offsets = NULL;
}
if (NULL != file_offsets_for_agg){
free(file_offsets_for_agg);
file_offsets_for_agg = NULL;
}
if (NULL != memory_displacements){
free(memory_displacements);
memory_displacements= NULL;
}
if (NULL != sendtype){
for (i = 0; i < fh->f_procs_per_group; i++) {
ompi_datatype_destroy(sendtype+i);
}
free(sendtype);
sendtype=NULL;
}
if (NULL != disp_index){
free(disp_index);
disp_index = NULL;

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

@ -992,6 +992,26 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh,
exit :
if (fh->f_procs_in_group[fh->f_aggregator_index] == fh->f_rank) {
if (NULL != sorted_file_offsets){
free(sorted_file_offsets);
sorted_file_offsets = NULL;
}
if(NULL != file_offsets_for_agg){
free(file_offsets_for_agg);
file_offsets_for_agg = NULL;
}
if (NULL != memory_displacements){
free(memory_displacements);
memory_displacements = NULL;
}
if (NULL != recvtype){
for (i =0; i< fh->f_procs_per_group; i++) {
ompi_datatype_destroy(recvtype+i);
}
free(recvtype);
recvtype=NULL;
}
if (NULL != fh->f_io_array) {
free (fh->f_io_array);
fh->f_io_array = NULL;
@ -1033,6 +1053,16 @@ mca_fcoll_dynamic_file_write_all (mca_io_ompio_file_t *fh,
}
if (! (fh->f_flags & OMPIO_CONTIGUOUS_MEMORY)) {
if (NULL != send_buf) {
free (send_buf);
send_buf = NULL;
}
}
if (NULL != global_buf) {
free (global_buf);
global_buf = NULL;
}
if (NULL != sorted) {
free (sorted);
sorted = NULL;