From 803519ae59cc8214a898159a27131d7c96a7a157 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 1 Aug 2019 08:28:13 +1000 Subject: [PATCH] tools: record: fix segfault on exit If we don't supply --with-libinput, the device is NULL so we can't unref it. Signed-off-by: Peter Hutterer --- tools/libinput-record.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/libinput-record.c b/tools/libinput-record.c index ff4a12f4..2d1400ef 100644 --- a/tools/libinput-record.c +++ b/tools/libinput-record.c @@ -2460,7 +2460,8 @@ main(int argc, char **argv) rc = mainloop(&ctx); out: list_for_each_safe(d, tmp, &ctx.devices, link) { - libinput_device_unref(d->device); + if (d->device) + libinput_device_unref(d->device); free(d->events); free(d->devnode); libevdev_free(d->evdev);