Skip to content

Commit 84aa3d6

Browse files
committed
API: document that insert_group() frees the input object on failure to insert
Refs #619 Signed-off-by: Brice Goglin <[email protected]>
1 parent 9f8ef0b commit 84aa3d6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

include/hwloc.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2793,7 +2793,12 @@ HWLOC_DECLSPEC hwloc_obj_t hwloc_topology_insert_misc_object(hwloc_topology_t to
27932793
*
27942794
* \return The allocated object on success.
27952795
* \return \c NULL on error.
2796-
*/
2796+
*
2797+
* \note The only way to free this object is to pass it to hwloc_topology_insert_group_object().
2798+
* If properly inserted, it will be freed when the entire topology is freed.
2799+
* If insertion failed (e.g. \c NULL or empty CPU and node-sets),
2800+
* it is freed before returning the error.
2801+
*/
27972802
HWLOC_DECLSPEC hwloc_obj_t hwloc_topology_alloc_group_object(hwloc_topology_t topology);
27982803

27992804
/** \brief Add more structure to the topology by adding an intermediate Group
@@ -2833,6 +2838,8 @@ HWLOC_DECLSPEC hwloc_obj_t hwloc_topology_alloc_group_object(hwloc_topology_t to
28332838
* hence the existing objects may get reordered (including PUs and NUMA nodes),
28342839
* and their logical indexes may change.
28352840
*
2841+
* \note If the insertion fails, the input group object is freed.
2842+
*
28362843
* \return The inserted object if it was properly inserted.
28372844
*
28382845
* \return An existing object if the Group was merged or discarded

0 commit comments

Comments
 (0)