Skip to content

Commit 148d70a

Browse files
committed
core: make sure memory children parent pointer is correct
when inserting an object in the middle and moving memchild to it. Signed-off-by: Brice Goglin <[email protected]>
1 parent 807e0a3 commit 148d70a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

hwloc/topology.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright © 2009 CNRS
3-
* Copyright © 2009-2019 Inria. All rights reserved.
3+
* Copyright © 2009-2020 Inria. All rights reserved.
44
* Copyright © 2009-2012, 2020 Université Bordeaux
55
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
66
* See COPYING in top-level directory.
@@ -1392,7 +1392,7 @@ static struct hwloc_obj *
13921392
hwloc___insert_object_by_cpuset(struct hwloc_topology *topology, hwloc_obj_t cur, hwloc_obj_t obj,
13931393
hwloc_report_error_t report_error)
13941394
{
1395-
hwloc_obj_t child, next_child = NULL;
1395+
hwloc_obj_t child, next_child = NULL, tmp;
13961396
/* These will always point to the pointer to their next last child. */
13971397
hwloc_obj_t *cur_children = &cur->first_child;
13981398
hwloc_obj_t *obj_children = &obj->first_child;
@@ -1464,6 +1464,8 @@ hwloc___insert_object_by_cpuset(struct hwloc_topology *topology, hwloc_obj_t cur
14641464
if (setres == HWLOC_OBJ_EQUAL) {
14651465
obj->memory_first_child = child->memory_first_child;
14661466
child->memory_first_child = NULL;
1467+
for(tmp=obj->memory_first_child; tmp; tmp = tmp->next_sibling)
1468+
tmp->parent = obj;
14671469
}
14681470
break;
14691471
}

0 commit comments

Comments
 (0)