evdev: free aux_data struct in fallback destroy function 81/191181/2 accepted/tizen_5.0_unified tizen_5.0 accepted/tizen/5.0/unified/20181112.060758 accepted/tizen/unified/20181108.172419 submit/tizen/20181108.065806 submit/tizen_5.0/20181108.065827
authorJengHyun Kang <jhyuni.kang@samsung.com>
Fri, 12 Oct 2018 07:00:46 +0000 (16:00 +0900)
committerjeon <jhyuni.kang@samsung.com>
Tue, 23 Oct 2018 05:44:48 +0000 (14:44 +0900)
Change-Id: Ief8b7ed7bf1aea714e635ca2661450b519012015

src/evdev.c
src/evdev.h

index ec0dfef475cc3fe5c167bdb12a04e7bb0cda1bfc..d55d2c20427bb94358096e840f83b06bff75a925 100644 (file)
@@ -1486,6 +1486,19 @@ static void
 fallback_destroy(struct evdev_dispatch *evdev_dispatch)
 {
        struct fallback_dispatch *dispatch = fallback_dispatch(evdev_dispatch);
+       struct mt_aux_data *aux_data, *aux_data_tmp;
+       int i, slot_len;
+
+       slot_len = (int)dispatch->mt.slots_len;
+
+       for (i = 0; i < slot_len; i++) {
+               list_for_each_safe(aux_data, aux_data_tmp, &dispatch->mt.aux_data_list[i], link) {
+                       list_remove(&aux_data->link);
+                       free(aux_data);
+               }
+               list_remove(&dispatch->mt.aux_data_list[i]);
+       }
+       free(dispatch->mt.aux_data_list);
 
        free(dispatch->mt.slots);
        free(dispatch);
@@ -3733,7 +3746,6 @@ evdev_device_destroy(struct evdev_device *device)
        struct evdev_dispatch *dispatch;
 
        dispatch = device->dispatch;
-       evdev_device_free_aux_data(device);
        if (dispatch)
                dispatch->interface->destroy(dispatch);
 
@@ -3838,24 +3850,3 @@ failed:
                }
        }
 }
-
-void
-evdev_device_free_aux_data(struct evdev_device *device)
-{
-       int i;
-       struct fallback_dispatch *dispatch;
-       struct mt_aux_data *aux_data, *aux_data_tmp;
-
-       if (!device || !device->dispatch) return;
-
-       dispatch = fallback_dispatch(device->dispatch);
-
-       for (i = 0; i < (int)dispatch->mt.slots_len; i++) {
-               list_for_each_safe(aux_data, aux_data_tmp, &dispatch->mt.aux_data_list[i], link) {
-                       list_remove(&aux_data->link);
-                       free(aux_data);
-               }
-               list_remove(&dispatch->mt.aux_data_list[i]);
-       }
-       free(dispatch->mt.aux_data_list);
-}
index 5351ef3371f949cf11efe8c5edca5217f73961e9..751d9204c7754797d4c473d95e74677746857c51 100644 (file)
@@ -907,7 +907,4 @@ 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 */