From ecdad20827503ee9beb24f90351dc5588fbb3ed0 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 18 Apr 2019 14:22:48 +0000 Subject: [PATCH] wayland: Avoid using uninitialized memory _gdk_wayland_cursor_get_buffer was not initializing its out variables in the 'not found' case. This was showing up in protocol traces as garbage hotspots being sent to the compositor. Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1328 --- gdk/wayland/gdkcursor-wayland.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gdk/wayland/gdkcursor-wayland.c b/gdk/wayland/gdkcursor-wayland.c index ec6c19ca63..91d80e3018 100644 --- a/gdk/wayland/gdkcursor-wayland.c +++ b/gdk/wayland/gdkcursor-wayland.c @@ -169,14 +169,7 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display, struct wl_cursor *c; if (g_str_equal (gdk_cursor_get_name (cursor), "none")) - { - *hotspot_x = 0; - *hotspot_y = 0; - *width = 0; - *height = 0; - *scale = 1; - return NULL; - } + goto none; c = gdk_wayland_cursor_load_for_name (display, _gdk_wayland_display_get_scaled_cursor_theme (display, desired_scale), @@ -250,6 +243,13 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display, width, height, scale); +none: + *hotspot_x = 0; + *hotspot_y = 0; + *width = 0; + *height = 0; + *scale = 1; + return NULL; }