Skip to content

Commit 74a02b5

Browse files
committed
shmem: duplicate topo infos so that we may modify them
Signed-off-by: Brice Goglin <[email protected]>
1 parent a54d2aa commit 74a02b5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

hwloc/shmem.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright © 2017-2022 Inria. All rights reserved.
2+
* Copyright © 2017-2023 Inria. All rights reserved.
33
* See COPYING in top-level directory.
44
*/
55

@@ -227,6 +227,11 @@ hwloc_shmem_topology_adopt(hwloc_topology_t *topologyp,
227227
/* clear userdata callbacks pointing to the writer process' functions */
228228
new->userdata_export_cb = NULL;
229229
new->userdata_import_cb = NULL;
230+
/* duplicate topo infos so that we can modify them */
231+
new->infos.array = NULL;
232+
new->infos.count = 0;
233+
new->infos.allocated = 0;
234+
hwloc__tma_dup_infos(NULL, &new->infos, &old->infos);
230235

231236
#ifndef HWLOC_DEBUG
232237
if (getenv("HWLOC_DEBUG_CHECK"))
@@ -253,6 +258,7 @@ void
253258
hwloc__topology_disadopt(hwloc_topology_t topology)
254259
{
255260
hwloc_components_fini();
261+
hwloc__free_infos(&topology->infos);
256262
munmap(topology->adopted_shmem_addr, topology->adopted_shmem_length);
257263
free(topology->support.discovery);
258264
free(topology->support.cpubind);

0 commit comments

Comments
 (0)