Skip to content

Commit d89c462

Browse files
committed
ob1: fix minor memory leak
Remove an accidental second OBJ_CONSTRUCT of a local opal_bitmap_t variable "reachable". Signed-off-by: Jeff Squyres <jeff@squyres.com>
1 parent 14ecf5d commit d89c462

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

ompi/mca/pml/ob1/pml_ob1.c

Lines changed: 5 additions & 9 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,28 +383,23 @@ 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) {
400400
return rc;
401401
}
402402

403-
if (NULL == mca_bml.bml_add_procs) {
404-
return OMPI_ERR_UNREACH;
405-
}
406-
407403
rc = mca_bml.bml_add_procs (nprocs, procs, &reachable);
408404
OBJ_DESTRUCT(&reachable);
409405
if (OMPI_SUCCESS != rc) {

0 commit comments

Comments
 (0)