[PATCH xf86-input-libinput] Unref the libinput context on pre_init failure

Hans de Goede hdegoede at redhat.com
Tue Nov 17 01:15:10 PST 2015


Hi,

On 17-11-15 09:20, Peter Hutterer wrote:
> A device that fails pre_init has a ref to the libinput context but may not
> have a pInfo->private. For those devices we never call libinput_unref() and
> the libinput struct never gets freed.
>
> Thus if at least one device didn't pass pre_init, we never cleaned up after
> ourselves.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

Looks good to me: Reviewed-by: Hans de Goede <hdegoede at redhat.com>

Regards,

Hans


> ---
>   src/xf86libinput.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/src/xf86libinput.c b/src/xf86libinput.c
> index f69943c..a4d9bd5 100644
> --- a/src/xf86libinput.c
> +++ b/src/xf86libinput.c
> @@ -1576,6 +1576,8 @@ fail:
>   		valuator_mask_free(&driver_data->valuators_unaccelerated);
>   	free(path);
>   	free(driver_data);
> +	if (libinput)
> +		driver_context.libinput = libinput_unref(libinput);
>   	return BadValue;
>   }
>
>


More information about the xorg-devel mailing list