Skip to content

Commit

Permalink
Merge pull request #5682 from grondo/rlist-fixes
Browse files Browse the repository at this point in the history
librlist: fix segfault when initializing topology from XML in later hwloc versions
  • Loading branch information
mergify[bot] authored Jan 17, 2024
2 parents ead829e + 3824a69 commit d00494b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/common/librlist/rhwloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static int init_topo_from_xml (hwloc_topology_t *tp,
unsigned long flags)
{
if ((topo_init_common (tp, flags) < 0)
|| (hwloc_topology_set_xmlbuffer (*tp, xml, strlen (xml) + 1) < 0)
|| (hwloc_topology_set_xmlbuffer (*tp, xml, strlen (xml)) < 0)
|| (hwloc_topology_load (*tp) < 0)) {
hwloc_topology_destroy (*tp);
return (-1);
Expand Down
3 changes: 2 additions & 1 deletion src/common/librlist/rlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -2380,7 +2380,8 @@ struct rlist *rlist_from_hwloc (int rank, const char *xml)
rlist_destroy (rl);
rnode_destroy (n);
free (ids);
hwloc_topology_destroy (topo);
if (topo)
hwloc_topology_destroy (topo);
return NULL;
}

Expand Down

0 comments on commit d00494b

Please sign in to comment.