[PATCH weston 6/6] input: Free the memory allocated to store the device resource lists
Rob Bradford
robert.bradford at intel.com
Mon Jul 22 09:51:07 PDT 2013
Urgh - I misread the implementation of wl_array_for_each - I missed
that it works bytewise through the array rather than sizeof(char *)
steps.
I'll follow-up with some patches to solve this.
Rob
On 22 July 2013 17:31, Rob Bradford <robert.bradford at intel.com> wrote:
> From: Rob Bradford <rob at linux.intel.com>
>
> ---
> src/input.c | 21 ++++++++++++++++++---
> 1 file changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/src/input.c b/src/input.c
> index 25f2a3e..d4c28fb 100644
> --- a/src/input.c
> +++ b/src/input.c
> @@ -366,10 +366,15 @@ weston_pointer_create(void)
> WL_EXPORT void
> weston_pointer_destroy(struct weston_pointer *pointer)
> {
> + void *p;
> +
> if (pointer->sprite)
> pointer_unmap_sprite(pointer);
>
> - /* XXX: What about pointer->resource_list? */
> + wl_array_for_each(p, &pointer->resources)
> + free(p);
> + wl_array_release(&pointer->resources);
> +
> if (!wl_list_empty(pointer->focus_resource_list))
> wl_list_remove(&pointer->focus_listener.link);
> free(pointer);
> @@ -400,7 +405,12 @@ weston_keyboard_create(void)
> WL_EXPORT void
> weston_keyboard_destroy(struct weston_keyboard *keyboard)
> {
> - /* XXX: What about keyboard->resource_list? */
> + void *p;
> +
> + wl_array_for_each(p, &keyboard->resources)
> + free(p);
> + wl_array_release(&keyboard->resources);
> +
> if (!wl_list_empty(keyboard->focus_resource_list))
> wl_list_remove(&keyboard->focus_listener.link);
> wl_array_release(&keyboard->keys);
> @@ -431,7 +441,12 @@ weston_touch_create(void)
> WL_EXPORT void
> weston_touch_destroy(struct weston_touch *touch)
> {
> - /* XXX: What about touch->resource_list? */
> + void *p;
> +
> + wl_array_for_each(p, &touch->resources)
> + free(p);
> + wl_array_release(&touch->resources);
> +
> if (!wl_list_empty(touch->focus_resource_list))
> wl_list_remove(&touch->focus_listener.link);
> free(touch);
> --
> 1.8.3.1
>
More information about the wayland-devel
mailing list