e_input: fixed leak regarding ecore_device removal 17/266417/3 submit/tizen/20211112.065923
authorSung-Jin Park <sj76.park@samsung.com>
Sat, 5 Jun 2021 01:04:38 +0000 (10:04 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Sat, 5 Jun 2021 01:24:08 +0000 (10:24 +0900)
Change-Id: I4eb0c6e7d74f48cf067d3f379e268e74a4ff51e4
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
src/bin/e_input_inputs.c

index c33a8c3..284c9ea 100644 (file)
@@ -224,13 +224,18 @@ _e_input_remove_ecore_device(E_Input_Evdev *edev, Ecore_Device_Class clas)
          if (!identifier) continue;
          if ((ecore_device_class_get(dev) == clas) && (!strcmp(identifier, edev->path)))
            {
-              if (edev->ecore_dev) edev->ecore_dev = NULL;
+              if (edev->ecore_dev)
+                {
+                   ecore_device_unref(dev);
+                   edev->ecore_dev = NULL;
+                }
               else if (edev->ecore_dev_list)
                 {
                    EINA_LIST_FOREACH_SAFE(edev->ecore_dev_list, ll, ll_next, data)
                      {
                         if (data == dev)
                           {
+                             ecore_device_unref(dev);
                              edev->ecore_dev_list = eina_list_remove_list(edev->ecore_dev_list, ll);
                           }
                      }
@@ -301,6 +306,7 @@ _e_input_device_remove(E_Input_Evdev *edev)
                   WRN("Invalid device is left. name: %s, identifier: %s, clas: %s\n",
                       ecore_device_name_get(data), ecore_device_description_get(data),
                       _e_input_ecore_device_class_to_string(ecore_device_class_get(data)));
+                  ecore_device_unref(data);
                   ecore_device_del(data);
                }
           }