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

Peter Hutterer peter.hutterer at who-t.net
Tue Nov 17 00:20:01 PST 2015


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>
---
 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;
 }
 
-- 
2.5.0



More information about the xorg-devel mailing list