From d16df8d100bf0111401cdebae80233e28bc86c6c Mon Sep 17 00:00:00 2001 From: ksv1986 Date: Wed, 15 Apr 2020 19:01:33 +0300 Subject: [PATCH] hidpp10: fix crash if device failed to initialize properly Signed-off-by: ksv1986 --- src/driver-hidpp10.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/driver-hidpp10.c b/src/driver-hidpp10.c index 7fc05b03..eaa83d19 100644 --- a/src/driver-hidpp10.c +++ b/src/driver-hidpp10.c @@ -752,14 +752,14 @@ static void hidpp10drv_remove(struct ratbag_device *device) { struct hidpp10drv_data *drv_data; - struct hidpp10_device *dev; ratbag_close_hidraw(device); drv_data = ratbag_get_drv_data(device); - dev = drv_data->dev; + if (!drv_data) + return; - hidpp10_device_destroy(dev); + hidpp10_device_destroy(drv_data->dev); free(drv_data); }