Skip to content
Snippets Groups Projects
Commit 75bf4a08 authored by Pekka Paalanen's avatar Pekka Paalanen
Browse files

compositor-drm: drm_property_info_free() must reset


This function needs to reset the structures to NULL, otherwise it is not
possible to re-use a once "freed" property info array.

Being able to re-use an array is useful when the memory allocation and
array lifetimes do not match. A specific example is drm_output that is
changed to allocate the CRTC on enable() and deallocate it on disable().
A drm_output might be enabled and disabled multiple times.

Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
parent 94e14764
No related branches found
No related tags found
No related merge requests found
......@@ -760,7 +760,9 @@ drm_property_info_populate(struct drm_backend *b,
/**
* Free DRM property information
*
* Frees all memory associated with a DRM property info array.
* Frees all memory associated with a DRM property info array and zeroes
* it out, leaving it usable for a further drm_property_info_update() or
* drm_property_info_free().
*
* @param info DRM property info array
* @param num_props Number of entries in array to free
......@@ -772,6 +774,8 @@ drm_property_info_free(struct drm_property_info *info, int num_props)
for (i = 0; i < num_props; i++)
free(info[i].enum_values);
memset(info, 0, sizeof(*info) * num_props);
}
static void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment