Skip to content

Commit 501eb8d

Browse files
committed
ompio: plug misc memory leaks
Signed-off-by: Gilles Gouaillardet <[email protected]>
1 parent 1a6c17e commit 501eb8d

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

ompi/mca/common/ompio/common_ompio_file_open.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
1212
* Copyright (c) 2008-2017 University of Houston. All rights reserved.
13-
* Copyright (c) 2015 Research Organization for Information Science
13+
* Copyright (c) 2015-2017 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
1515
* Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
1616
* $COPYRIGHT$
@@ -307,6 +307,10 @@ int mca_common_ompio_file_close (mca_io_ompio_file_t *ompio_fh)
307307
ompio_fh->f_io_array = NULL;
308308
}
309309

310+
if (NULL != ompio_fh->f_init_aggr_list) {
311+
free (ompio_fh->f_init_aggr_list);
312+
ompio_fh->f_init_aggr_list = NULL;
313+
}
310314
if (NULL != ompio_fh->f_init_procs_in_group) {
311315
free (ompio_fh->f_init_procs_in_group);
312316
ompio_fh->f_init_procs_in_group = NULL;
@@ -358,7 +362,7 @@ int mca_common_ompio_file_close (mca_io_ompio_file_t *ompio_fh)
358362
}
359363

360364

361-
if (MPI_COMM_NULL != ompio_fh->f_comm && (ompio_fh->f_flags & OMPIO_SHAREDFP_IS_SET) ) {
365+
if (MPI_COMM_NULL != ompio_fh->f_comm) {
362366
ompi_comm_free (&ompio_fh->f_comm);
363367
}
364368

ompi/mca/io/ompio/io_ompio_aggregators.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Copyright (c) 2008-2016 University of Houston. All rights reserved.
1414
* Copyright (c) 2011-2015 Cisco Systems, Inc. All rights reserved.
1515
* Copyright (c) 2012-2013 Inria. All rights reserved.
16-
* Copyright (c) 2015-2016 Research Organization for Information Science
16+
* Copyright (c) 2015-2017 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
1818
* $COPYRIGHT$
1919
*
@@ -315,6 +315,9 @@ int mca_io_ompio_finalize_initial_grouping(mca_io_ompio_file_t *fh,
315315
int y = 0;
316316

317317
fh->f_init_num_aggrs = num_groups;
318+
if (NULL != fh->f_init_aggr_list) {
319+
free(fh->f_init_aggr_list);
320+
}
318321
fh->f_init_aggr_list = (int*)malloc (fh->f_init_num_aggrs * sizeof(int));
319322
if (NULL == fh->f_init_aggr_list) {
320323
opal_output (1, "OUT OF MEMORY\n");
@@ -325,6 +328,9 @@ int mca_io_ompio_finalize_initial_grouping(mca_io_ompio_file_t *fh,
325328
for( y = 0; y < contg_groups[z].procs_per_contg_group; y++){
326329
if ( fh->f_rank == contg_groups[z].procs_in_contg_group[y] ) {
327330
fh->f_init_procs_per_group = contg_groups[z].procs_per_contg_group;
331+
if (NULL != fh->f_init_procs_in_group) {
332+
free(fh->f_init_procs_in_group);
333+
}
328334
fh->f_init_procs_in_group = (int*)malloc (fh->f_init_procs_per_group * sizeof(int));
329335
if (NULL == fh->f_init_procs_in_group) {
330336
opal_output (1, "OUT OF MEMORY\n");

0 commit comments

Comments
 (0)