Skip to content

Commit db52ca9

Browse files
committed
core: don't crash when clearing an already empty topology
If all objects got removed because cgroups were wrong, we'd crash when trying to clear the topology because the root is already NULL. Signed-off-by: Brice Goglin <[email protected]>
1 parent a24d023 commit db52ca9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

hwloc/topology.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,8 @@ unlink_and_free_object_and_children(hwloc_obj_t *pobj)
783783
void
784784
hwloc_free_object_and_children(hwloc_obj_t obj)
785785
{
786-
unlink_and_free_object_and_children(&obj);
786+
if (obj)
787+
unlink_and_free_object_and_children(&obj);
787788
}
788789

789790
/* Free an object, its next siblings and their children without unlinking from parent.

0 commit comments

Comments
 (0)