wlr_pointer: fix potential null deref

if pointer is null here we'd access pointer->events... anyway
This commit is contained in:
Dominique Martinet 2018-03-22 19:57:11 +01:00
parent d5e14ab247
commit e86cd4dc33

View file

@ -14,7 +14,10 @@ void wlr_pointer_init(struct wlr_pointer *pointer,
} }
void wlr_pointer_destroy(struct wlr_pointer *pointer) { void wlr_pointer_destroy(struct wlr_pointer *pointer) {
if (pointer && pointer->impl && pointer->impl->destroy) { if (!pointer) {
return;
}
if (pointer->impl && pointer->impl->destroy) {
pointer->impl->destroy(pointer); pointer->impl->destroy(pointer);
} else { } else {
wl_list_remove(&pointer->events.motion.listener_list); wl_list_remove(&pointer->events.motion.listener_list);