From 4f7b1382d4ceb1ed308563809d485ea6c047f077 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Sat, 30 Jun 2018 10:03:26 +0900 Subject: [PATCH] wayland backend seat: fix NULL output check The test was done after dereferencing output in pointer_handle_enter, just move it up one line. No reason pointer_handle_leave would not need the check if enter needs it, add it there. Found through static analysis. --- backend/wayland/wl_seat.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/backend/wayland/wl_seat.c b/backend/wayland/wl_seat.c index 8ed61409..d5001a51 100644 --- a/backend/wayland/wl_seat.c +++ b/backend/wayland/wl_seat.c @@ -38,10 +38,8 @@ static void pointer_handle_enter(void *data, struct wl_pointer *wl_pointer, } struct wlr_wl_output *output = wl_surface_get_user_data(surface); + assert(output); struct wlr_wl_pointer *pointer = output_get_pointer(output); - if (output == NULL) { - return; - } output->enter_serial = serial; backend->current_pointer = pointer; @@ -56,6 +54,7 @@ static void pointer_handle_leave(void *data, struct wl_pointer *wl_pointer, } struct wlr_wl_output *output = wl_surface_get_user_data(surface); + assert(output); output->enter_serial = 0; if (backend->current_pointer == NULL ||