From: JengHyun Kang Date: Fri, 12 Oct 2018 07:00:46 +0000 (+0900) Subject: evdev: free aux_data struct in fallback destroy function X-Git-Tag: submit/tizen/20181108.065806^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Faccepted%2Ftizen_5.0_unified;p=platform%2Fupstream%2Flibinput.git evdev: free aux_data struct in fallback destroy function Change-Id: Ief8b7ed7bf1aea714e635ca2661450b519012015 --- diff --git a/src/evdev.c b/src/evdev.c index ec0dfef4..d55d2c20 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -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); -} diff --git a/src/evdev.h b/src/evdev.h index 5351ef33..751d9204 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -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 */