[PATCH libinput 1/2] test: unref the litest device *after* removing it from the path interface

Jonas Ådahl jadahl at gmail.com
Thu Oct 19 01:50:32 UTC 2017


On Thu, Oct 19, 2017 at 08:39:02AM +1000, Peter Hutterer wrote:
> Our own reference may be the last one that's still alive if the context is
> currently suspended (litest_suspend()). If we unref before removing it from
> the path interface, we access already freed memory.
> 
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

This and the next is

Reviewed-by: Jonas Ådahl <jadahl at gmail.com>

> ---
>  test/litest.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/test/litest.c b/test/litest.c
> index 4f26771f..d34bd3c5 100644
> --- a/test/litest.c
> +++ b/test/litest.c
> @@ -1341,8 +1341,8 @@ litest_delete_device(struct litest_device *d)
>  	litest_assert_int_eq(d->skip_ev_syn, 0);
>  
>  	if (d->libinput_device) {
> -		libinput_device_unref(d->libinput_device);
>  		libinput_path_remove_device(d->libinput_device);
> +		libinput_device_unref(d->libinput_device);
>  	}
>  	if (d->owns_context)
>  		libinput_unref(d->libinput);
> -- 
> 2.13.6
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list