Commit b67d65b4 authored by Jakob Bornecrantz's avatar Jakob Bornecrantz Committed by Jakob Bornecrantz

aux/util: Add function to free device and stuff hanging off it

parent 9b662596
......@@ -273,3 +273,17 @@ u_device_allocate(enum u_device_alloc_flags flags,
return xdev;
}
void
u_device_free(struct xrt_device *xdev)
{
if (xdev->hmd != NULL) {
free(xdev->hmd->distortion.mesh.vertices);
xdev->hmd->distortion.mesh.vertices = NULL;
free(xdev->hmd->distortion.mesh.indices);
xdev->hmd->distortion.mesh.indices = NULL;
}
free(xdev);
}
......@@ -80,6 +80,8 @@ u_device_dump_config(struct xrt_device *xdev,
* placed after the device in memory.
*
* Will setup any pointers and num values.
*
* @ingroup aux_util
*/
void *
u_device_allocate(enum u_device_alloc_flags flags,
......@@ -87,6 +89,14 @@ u_device_allocate(enum u_device_alloc_flags flags,
size_t num_inputs,
size_t num_outputs);
/*!
* Helper function to free a device and any data hanging of it.
*
* @ingroup aux_util
*/
void
u_device_free(struct xrt_device *xdev);
#ifdef __cplusplus
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment