From 1154bfb2ed6f76444eb8c1d8c83ab282c8a73c8c Mon Sep 17 00:00:00 2001 From: "duna.oh" Date: Tue, 19 Mar 2024 11:04:16 +0900 Subject: [PATCH] e_input: unref udev_device after using it After calling libinput_device_get_udev_device(), the caller must call udev_device_unref() Change-Id: I097341e03713647939c66840197a34da97deafef --- src/bin/e_input_evdev.c | 12 ++++++++++-- src/bin/e_input_inputs.c | 8 ++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/bin/e_input_evdev.c b/src/bin/e_input_evdev.c index 0cbe09c..a340425 100644 --- a/src/bin/e_input_evdev.c +++ b/src/bin/e_input_evdev.c @@ -89,7 +89,11 @@ _device_calibration_set(E_Input_Evdev *edev) if ((!vals) || (sscanf(vals, "%f %f %f %f %f %f", &cal[0], &cal[1], &cal[2], &cal[3], &cal[4], &cal[5]) != 6)) - return; + { + udev_device_unref(udev_device); + return; + } + udev_device_unref(udev_device); ELOGF("E_INPUT_EVDEV", "calibration_set cal[%lf %lf %lf %lf %lf %lf] (%d x %d)", NULL, cal[0], cal[1], cal[2], cal[3], cal[4], cal[5], w, h); @@ -2491,7 +2495,11 @@ e_input_evdev_axis_size_set(E_Input_Evdev *edev, int w, int h) if ((!vals) || (sscanf(vals, "%f %f %f %f %f %f", &cal[0], &cal[1], &cal[2], &cal[3], &cal[4], &cal[5]) != 6)) - return; + { + udev_device_unref(udev_device); + return; + } + udev_device_unref(udev_device); ELOGF("E_INPUT_EVDEV", "axis_size_set cal[%lf %lf %lf %lf %lf %lf] (%d x %d)", NULL, cal[0], cal[1], cal[2], cal[3], cal[4], cal[5], w, h); diff --git a/src/bin/e_input_inputs.c b/src/bin/e_input_inputs.c index d1af561..54238cf 100644 --- a/src/bin/e_input_inputs.c +++ b/src/bin/e_input_inputs.c @@ -444,6 +444,12 @@ _e_input_device_get_ecore_device_subclass(E_Input_Evdev *edev, Ecore_Device_Clas const char *devpath; udev_device = libinput_device_get_udev_device(edev->device); + if (!udev_device) + { + ERR("no udev_device"); + return subclas; + } + devpath = udev_device_get_property_value(udev_device, "DEVPATH"); if (devpath && strstr(devpath, "virtual/input")) { @@ -452,6 +458,8 @@ _e_input_device_get_ecore_device_subclass(E_Input_Evdev *edev, Ecore_Device_Clas else if (clas == ECORE_DEVICE_CLASS_KEYBOARD) subclas = ECORE_DEVICE_SUBCLASS_VIRTUAL_REMOCON; } + udev_device_unref(udev_device); + return subclas; } -- 2.7.4