diff --git a/opal/mca/hwloc/base/hwloc_base_open.c b/opal/mca/hwloc/base/hwloc_base_open.c index 3c77320b77..b077074a6f 100644 --- a/opal/mca/hwloc/base/hwloc_base_open.c +++ b/opal/mca/hwloc/base/hwloc_base_open.c @@ -333,6 +333,7 @@ static void topo_data_const(opal_hwloc_topo_data_t *ptr) { ptr->available = NULL; OBJ_CONSTRUCT(&ptr->summaries, opal_list_t); + ptr->userdata = NULL; } static void topo_data_dest(opal_hwloc_topo_data_t *ptr) { @@ -345,6 +346,7 @@ static void topo_data_dest(opal_hwloc_topo_data_t *ptr) OBJ_RELEASE(item); } OBJ_DESTRUCT(&ptr->summaries); + ptr->userdata = NULL; } OBJ_CLASS_INSTANCE(opal_hwloc_topo_data_t, opal_object_t, diff --git a/opal/mca/hwloc/base/hwloc_base_util.c b/opal/mca/hwloc/base/hwloc_base_util.c index 1c8e385a3f..36d06dad02 100644 --- a/opal/mca/hwloc/base/hwloc_base_util.c +++ b/opal/mca/hwloc/base/hwloc_base_util.c @@ -240,6 +240,7 @@ static void free_object(hwloc_obj_t obj) if (NULL != obj->userdata) { data = (opal_hwloc_obj_data_t*)obj->userdata; OBJ_RELEASE(data); + obj->userdata = NULL; } /* loop thru our children */ @@ -259,6 +260,7 @@ void opal_hwloc_base_free_topology(hwloc_topology_t topo) if (NULL != obj->userdata) { rdata = (opal_hwloc_topo_data_t*)obj->userdata; OBJ_RELEASE(rdata); + obj->userdata = NULL; } /* now recursively descend and release userdata * in the rest of the objects diff --git a/opal/mca/hwloc/hwloc.h b/opal/mca/hwloc/hwloc.h index 48574b926f..bb9aa6cb61 100644 --- a/opal/mca/hwloc/hwloc.h +++ b/opal/mca/hwloc/hwloc.h @@ -132,6 +132,9 @@ typedef struct { opal_object_t super; hwloc_cpuset_t available; opal_list_t summaries; + + /** \brief Additional space for custom data */ + void *userdata; } opal_hwloc_topo_data_t; OBJ_CLASS_DECLARATION(opal_hwloc_topo_data_t);