e_input: unref udev_device after using it 64/308164/1
authorduna.oh <duna.oh@samsung.com>
Tue, 19 Mar 2024 02:04:16 +0000 (11:04 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Tue, 19 Mar 2024 02:23:27 +0000 (11:23 +0900)
After calling libinput_device_get_udev_device(), the caller must call
udev_device_unref()

Change-Id: I097341e03713647939c66840197a34da97deafef

src/bin/e_input_evdev.c
src/bin/e_input_inputs.c

index 0cbe09c..a340425 100644 (file)
@@ -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);
index d1af561..54238cf 100644 (file)
@@ -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;
 }