evdev: free aux_data list when device is destroy 65/132765/1
authorJengHyun Kang <jhyuni.kang@samsung.com>
Wed, 7 Jun 2017 11:10:07 +0000 (20:10 +0900)
committerJengHyun Kang <jhyuni.kang@samsung.com>
Wed, 7 Jun 2017 11:10:07 +0000 (20:10 +0900)
Change-Id: I76f8df6b8fed1d01540c1430247ffc00dc28dfc5

src/evdev.c
src/evdev.h

index 2716b371e33f2bd9bc5f703b0e0fe8268649bd52..369149b89ed434ed2d6ccf17dd3ebf9c2804a754 100644 (file)
@@ -2421,6 +2421,7 @@ evdev_device_destroy(struct evdev_device *device)
        libinput_seat_unref(device->base.seat);
        libevdev_free(device->evdev);
        udev_device_unref(device->udev_device);
+       evdev_device_free_aux_data(device);
        free(device->mt.slots);
        free(device);
 }
@@ -2462,3 +2463,19 @@ failed:
                }
        }
 }
+
+void
+evdev_device_free_aux_data(struct evdev_device *device)
+{
+       int i;
+       struct mt_aux_data *aux_data, *aux_data_tmp;
+
+       for (i = 0; i < (int)device->mt.slots_len; i++) {
+               list_for_each_safe(aux_data, aux_data_tmp, &device->mt.aux_data_list[i], link) {
+                       list_remove(&aux_data->link);
+                       free(aux_data);
+               }
+               list_remove(&device->mt.aux_data_list[i]);
+       }
+       free(device->mt.aux_data_list);
+}
index 81c83b22b3ad035d07dada05fb25e50510f07da6..5f9cee3c50ccb38d0ef2e8b29eaa07c9534ff04d 100644 (file)
@@ -381,4 +381,7 @@ evdev_device_has_aux_data(struct evdev_device *device, uint32_t code);
 
 void
 evdev_device_set_aux_data(struct evdev_device *device, uint32_t code);
+
+void
+evdev_device_free_aux_data(struct evdev_device *device);
 #endif /* EVDEV_H */