Skip to content

Commit 4baa380

Browse files
committed
v4.0.x: Applying fixes from #8217
These are not my changes, but I'm trying to incorporate them from the v4.0.x PR #8217. v4.0.x version of master PR #8747 Cherry-picked from the v4.0.x version, since master is missing a few of these files. Signed-off-by: Geoffrey Paulsen gpaulsen@us.ibm.com (cherry picked from commit 3a243ac)
1 parent 0e20abd commit 4baa380

File tree

8 files changed

+53
-7
lines changed

8 files changed

+53
-7
lines changed

ompi/mca/common/monitoring/common_monitoring.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,19 @@ int mca_common_monitoring_init( void )
228228

229229
void mca_common_monitoring_finalize( void )
230230
{
231-
if( ! mca_common_monitoring_enabled || /* Don't release if not last */
232-
0 < opal_atomic_sub_fetch_32(&mca_common_monitoring_hold, 1) ) return;
233-
231+
/* Even if not enabled, this string is allocated at l.310 */
232+
if (!mca_common_monitoring_enabled) {
233+
if (NULL != mca_common_monitoring_current_filename) {
234+
free(mca_common_monitoring_current_filename);
235+
mca_common_monitoring_current_filename = NULL;
236+
}
237+
return;
238+
}
239+
240+
/* Don't release if not last */
241+
if (0 < opal_atomic_sub_fetch_32(&mca_common_monitoring_hold, 1))
242+
return;
243+
234244
OPAL_MONITORING_PRINT_INFO("common_component_finish");
235245
/* Dump monitoring informations */
236246
mca_common_monitoring_flush(mca_common_monitoring_output_enabled,
@@ -241,11 +251,11 @@ void mca_common_monitoring_finalize( void )
241251
opal_output_close(mca_common_monitoring_output_stream_id);
242252
free(mca_common_monitoring_output_stream_obj.lds_prefix);
243253
/* Free internal data structure */
244-
free(pml_data); /* a single allocation */
245-
opal_hash_table_remove_all( common_monitoring_translation_ht );
254+
free(pml_data); /* a single allocation */
255+
opal_hash_table_remove_all(common_monitoring_translation_ht);
246256
OBJ_RELEASE(common_monitoring_translation_ht);
247257
mca_common_monitoring_coll_finalize();
248-
if( NULL != mca_common_monitoring_current_filename ) {
258+
if (NULL != mca_common_monitoring_current_filename) {
249259
free(mca_common_monitoring_current_filename);
250260
mca_common_monitoring_current_filename = NULL;
251261
}

ompi/mca/mtl/ofi/mtl_ofi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ ompi_mtl_ofi_add_procs(struct mca_mtl_base_module_t *mtl,
105105
goto bail;
106106
}
107107
memcpy(&ep_names[i*namelen], ep_name, namelen);
108+
free(ep_name); // malloc'd inside OFI_COMPAT_MODEX_RECV in pmix3x.c:1097
108109
}
109110

110111
/**

ompi/mca/mtl/ofi/mtl_ofi_component.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,12 @@ ompi_mtl_ofi_finalize(struct mca_mtl_base_module_t *mtl)
11291129
free(ompi_mtl_ofi.comm_to_context);
11301130
free(ompi_mtl_ofi.ofi_ctxt);
11311131

1132+
/* This was strdup()ed at L.714 */
1133+
if (NULL != ompi_mtl_ofi.provider_name) {
1134+
free(ompi_mtl_ofi.provider_name);
1135+
ompi_mtl_ofi.provider_name = NULL;
1136+
}
1137+
11321138
return OMPI_SUCCESS;
11331139

11341140
finalize_err:

opal/mca/btl/openib/btl_openib_component.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,11 @@ static int btl_openib_component_close(void)
211211
OBJ_DESTRUCT(&mca_btl_openib_component.srq_manager.lock);
212212
OBJ_DESTRUCT(&mca_btl_openib_component.srq_manager.srq_addr_table);
213213

214+
/* destroy the tx/rx queues */
215+
OBJ_DESTRUCT(&mca_btl_openib_component.send_free_coalesced);
216+
OBJ_DESTRUCT(&mca_btl_openib_component.send_user_free);
217+
OBJ_DESTRUCT(&mca_btl_openib_component.recv_user_free);
218+
214219
opal_btl_openib_connect_base_finalize();
215220
opal_btl_openib_ini_finalize();
216221

@@ -912,6 +917,7 @@ static void device_construct(mca_btl_openib_device_t *device)
912917
device->ib_channel = NULL;
913918
#endif
914919
device->btls = 0;
920+
device->allowed_btls = 0;
915921
device->endpoints = NULL;
916922
device->device_btls = NULL;
917923
device->ib_cq[BTL_OPENIB_HP_CQ] = NULL;
@@ -1876,6 +1882,8 @@ static int init_one_device(opal_list_t *btl_list, struct ibv_device* ib_dev)
18761882
device->rcache =
18771883
mca_rcache_base_module_create (mca_btl_openib_component.ib_rcache_name,
18781884
device, &rcache_resources);
1885+
free(rcache_resources.cache_name);
1886+
18791887
if (NULL == device->rcache) {
18801888
/* Don't print an error message here -- we'll get one from
18811889
mpool_create anyway */
@@ -2277,6 +2285,7 @@ static int init_one_device(opal_list_t *btl_list, struct ibv_device* ib_dev)
22772285
} else if (device->btls > 0) {
22782286
/* no port is allowed to be used by btl/openib,
22792287
* so release the device right away */
2288+
OBJ_RELEASE(device->device_btls);
22802289
OBJ_RELEASE(device);
22812290
return OPAL_SUCCESS;
22822291
}
@@ -2292,6 +2301,7 @@ static int init_one_device(opal_list_t *btl_list, struct ibv_device* ib_dev)
22922301
if (NULL != allowed_ports) {
22932302
free(allowed_ports);
22942303
}
2304+
OBJ_RELEASE(device->device_btls);
22952305
OBJ_RELEASE(device);
22962306
return ret;
22972307
}
@@ -2704,6 +2714,7 @@ btl_openib_component_init(int *num_btl_modules,
27042714
}
27052715
}
27062716

2717+
// These are used nowhere else, ergo...
27072718
OBJ_CONSTRUCT(&mca_btl_openib_component.send_free_coalesced, opal_free_list_t);
27082719
OBJ_CONSTRUCT(&mca_btl_openib_component.send_user_free, opal_free_list_t);
27092720
OBJ_CONSTRUCT(&mca_btl_openib_component.recv_user_free, opal_free_list_t);
@@ -2733,6 +2744,7 @@ btl_openib_component_init(int *num_btl_modules,
27332744
goto no_btls;
27342745
}
27352746

2747+
free(init_data);
27362748
init_data = (mca_btl_openib_frag_init_data_t *) malloc(sizeof(mca_btl_openib_frag_init_data_t));
27372749
if (NULL == init_data) {
27382750
BTL_ERROR(("Failed malloc: %s:%d", __FILE__, __LINE__));
@@ -2754,6 +2766,7 @@ btl_openib_component_init(int *num_btl_modules,
27542766
goto no_btls;
27552767
}
27562768

2769+
free(init_data);
27572770
init_data = (mca_btl_openib_frag_init_data_t *) malloc(sizeof(mca_btl_openib_frag_init_data_t));
27582771
if (NULL == init_data) {
27592772
BTL_ERROR(("Failed malloc: %s:%d", __FILE__, __LINE__));
@@ -2773,6 +2786,8 @@ btl_openib_component_init(int *num_btl_modules,
27732786
goto no_btls;
27742787
}
27752788

2789+
free(init_data);
2790+
27762791
/* If fork support is requested, try to enable it */
27772792
if (OPAL_SUCCESS != (ret = opal_common_verbs_fork_test())) {
27782793
goto no_btls;
@@ -3058,6 +3073,8 @@ btl_openib_component_init(int *num_btl_modules,
30583073
if (NULL != btls) {
30593074
free(btls);
30603075
}
3076+
3077+
opal_ibv_free_device_list(ib_devs);
30613078
return NULL;
30623079
}
30633080

opal/mca/btl/openib/btl_openib_ini.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,13 +358,15 @@ static int parse_line(parsed_section_values_t *sv)
358358
if (0 == strcasecmp(key_buffer, "vendor_id")) {
359359
if (OPAL_SUCCESS != (ret = opal_btl_openib_ini_intify_list(value, &sv->vendor_ids,
360360
&sv->vendor_ids_len))) {
361+
free(value);
361362
return ret;
362363
}
363364
}
364365

365366
else if (0 == strcasecmp(key_buffer, "vendor_part_id")) {
366367
if (OPAL_SUCCESS != (ret = opal_btl_openib_ini_intify_list(value, &sv->vendor_part_ids,
367368
&sv->vendor_part_ids_len))) {
369+
free(value);
368370
return ret;
369371
}
370372
}
@@ -468,6 +470,11 @@ static void reset_section(bool had_previous_value, parsed_section_values_t *s)
468470
if (NULL != s->vendor_part_ids) {
469471
free(s->vendor_part_ids);
470472
}
473+
// This could be freed here, or had_previous_value forwarded to
474+
// reset_values...
475+
if (NULL != s->values.receive_queues) {
476+
free(s->values.receive_queues);
477+
}
471478
}
472479

473480
s->name = NULL;

opal/mca/mpool/hugepage/mpool_hugepage_component.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,8 @@ static void mca_mpool_hugepage_find_hugepages (void) {
274274
opal_output_verbose (MCA_BASE_VERBOSE_INFO, opal_mpool_base_framework.framework_output,
275275
"found huge page with size = %lu, path = %s, mmap flags = 0x%x, with invalid "
276276
"permissions, skipping", hp->page_size, hp->path, hp->mmap_flags);
277-
}
277+
}
278+
OBJ_RELEASE(hp);
278279
}
279280

280281
opal_list_sort (&mca_mpool_hugepage_component.huge_pages, page_compare);

orte/mca/ess/base/ess_base_fns.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,9 @@ int orte_ess_base_proc_binding(void)
344344
}
345345
}
346346
}
347+
} else {
348+
/* Prevent cpus from being unfreed if we fall through */
349+
hwloc_bitmap_free(cpus);
347350
}
348351
} else {
349352
OPAL_OUTPUT_VERBOSE((5, orte_ess_base_framework.framework_output,

orte/util/show_help.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,7 @@ int orte_show_help_norender(const char *filename, const char *topic,
721721
nanosleep(&tp, NULL);
722722
}
723723
OBJ_RELEASE(buf);
724+
free(kv->data.bo.bytes);
724725
kv->data.bo.bytes = NULL;
725726
OPAL_LIST_DESTRUCT(&info);
726727
rc = ORTE_SUCCESS;

0 commit comments

Comments
 (0)