Skip to content

Commit 0473d58

Browse files
authored
Merge pull request #12061 from jsquyres/pr/v5.0.x/fix-minor-memory-leaks
v5.0.x: Fix minor memory leaks
2 parents 0455315 + 85497b0 commit 0473d58

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

ompi/mca/pml/ob1/pml_ob1.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
* Copyright (c) 2018-2021 Triad National Security, LLC. All rights
2727
* reserved.
2828
* Copyright (c) 2022 IBM Corporation. All rights reserved
29+
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
2930
* $COPYRIGHT$
3031
*
3132
* Additional copyrights may follow
@@ -382,18 +383,17 @@ int mca_pml_ob1_add_procs(ompi_proc_t** procs, size_t nprocs)
382383
if(nprocs == 0)
383384
return OMPI_SUCCESS;
384385

385-
OBJ_CONSTRUCT(&reachable, opal_bitmap_t);
386-
rc = opal_bitmap_init(&reachable, (int)nprocs);
387-
if(OMPI_SUCCESS != rc)
388-
return rc;
389-
390386
/* make sure remote procs are using the same PML as us */
391387
if (OMPI_SUCCESS != (rc = mca_pml_base_pml_check_selected("ob1",
392388
procs,
393389
nprocs))) {
394390
return rc;
395391
}
396392

393+
if (NULL == mca_bml.bml_add_procs) {
394+
return OMPI_ERR_UNREACH;
395+
}
396+
397397
OBJ_CONSTRUCT(&reachable, opal_bitmap_t);
398398
rc = opal_bitmap_init(&reachable, (int)nprocs);
399399
if (OMPI_SUCCESS != rc) {

opal/mca/base/mca_base_framework.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
88
* Copyright (c) 2018 Triad National Security, LLC. All rights
99
* reserved.
10+
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
1011
* $COPYRIGHT$
1112
*
1213
* Additional copyrights may follow
@@ -246,9 +247,11 @@ int mca_base_framework_close(struct mca_base_framework_t *framework)
246247

247248
/* close the framework and all of its components */
248249
if (is_open) {
250+
ret = OPAL_SUCCESS;
249251
if (NULL != framework->framework_close) {
250252
ret = framework->framework_close();
251-
} else {
253+
}
254+
if (OPAL_SUCCESS == ret) {
252255
ret = mca_base_framework_components_close(framework, NULL);
253256
}
254257

opal/mca/btl/tcp/btl_tcp_component.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* Copyright (c) 2014-2017 Research Organization for Information Science
2121
* and Technology (RIST). All rights reserved.
2222
* Copyright (c) 2018-2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
23+
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
2324
* $COPYRIGHT$
2425
*
2526
* Additional copyrights may follow
@@ -472,7 +473,7 @@ static int mca_btl_tcp_component_close(void)
472473
OBJ_DESTRUCT(&mca_btl_tcp_component.tcp_frag_max);
473474
OBJ_DESTRUCT(&mca_btl_tcp_component.tcp_frag_user);
474475
OBJ_DESTRUCT(&mca_btl_tcp_component.tcp_lock);
475-
OBJ_DESTRUCT(&mca_btl_tcp_component.local_ifs);
476+
OPAL_LIST_DESTRUCT(&mca_btl_tcp_component.local_ifs);
476477

477478
return OPAL_SUCCESS;
478479
}
@@ -667,6 +668,7 @@ static char **split_and_resolve(char **orig_str, char *name, bool reqd)
667668
"btl: tcp: Using interface: %s ", argv[i]);
668669
opal_argv_append(&interface_count, &interfaces, argv[i]);
669670
}
671+
free(argv[i]);
670672
continue;
671673
}
672674

0 commit comments

Comments
 (0)