diff --git a/hw/xwayland/xwayland-drm-lease.c b/hw/xwayland/xwayland-drm-lease.c index 30d363b59..4faf0eef8 100644 --- a/hw/xwayland/xwayland-drm-lease.c +++ b/hw/xwayland/xwayland-drm-lease.c @@ -455,7 +455,7 @@ xwl_screen_add_drm_lease_device(struct xwl_screen *xwl_screen, uint32_t id) { struct wp_drm_lease_device_v1 *lease_device = wl_registry_bind( xwl_screen->registry, id, &wp_drm_lease_device_v1_interface, 1); - struct xwl_drm_lease_device *device_data = malloc(sizeof(struct xwl_drm_lease_device)); + struct xwl_drm_lease_device *device_data = XNFcallocarray(1, sizeof(struct xwl_drm_lease_device)); device_data->drm_lease_device = lease_device; device_data->xwl_screen = xwl_screen; diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c index d9d03709f..8a470973e 100644 --- a/hw/xwayland/xwayland-input.c +++ b/hw/xwayland/xwayland-input.c @@ -3341,6 +3341,7 @@ xwl_pointer_warp_emulator_is_locked(struct xwl_pointer_warp_emulator *warp_emula static void xwl_pointer_warp_emulator_lock(struct xwl_pointer_warp_emulator *warp_emulator) { + BUG_RETURN(!warp_emulator); struct xwl_seat *xwl_seat = warp_emulator->xwl_seat; struct xwl_screen *xwl_screen = xwl_seat->xwl_screen; struct zwp_pointer_constraints_v1 *pointer_constraints = diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c index 07d58ee6a..cca9e6871 100644 --- a/hw/xwayland/xwayland-present.c +++ b/hw/xwayland/xwayland-present.c @@ -25,6 +25,8 @@ #include +#include "os/bug_priv.h" + #include #ifdef XWL_HAS_GLAMOR #include @@ -641,6 +643,8 @@ xwl_present_queue_vblank(ScreenPtr screen, return BadImplementation; } + BUG_RETURN_VAL(!xwl_present_window, BadImplementation); + event->vblank.exec_msc = msc; xorg_list_del(&event->vblank.event_queue); diff --git a/hw/xwayland/xwayland-screen.c b/hw/xwayland/xwayland-screen.c index 9b3b0e0ea..449674444 100644 --- a/hw/xwayland/xwayland-screen.c +++ b/hw/xwayland/xwayland-screen.c @@ -313,7 +313,8 @@ xwl_cursor_warped_to(DeviceIntPtr device, window = XYToWindow(sprite, x, y); xwl_window = xwl_window_from_window(window); - if (!xwl_window && xwl_seat->focus_window) { + + if (!xwl_window && xwl_seat && xwl_seat->focus_window) { focus = xwl_seat->focus_window->toplevel; /* Warps on non wl_surface backed Windows are only allowed @@ -525,7 +526,7 @@ registry_global(void *data, struct wl_registry *registry, uint32_t id, } else if (strcmp(interface, wp_drm_lease_device_v1_interface.name) == 0) { if (xwl_screen->screen->root == NULL) { - struct xwl_queued_drm_lease_device *queued = malloc(sizeof(struct xwl_queued_drm_lease_device)); + struct xwl_queued_drm_lease_device *queued = XNFcallocarray(1, sizeof(struct xwl_queued_drm_lease_device)); queued->id = id; xorg_list_append(&queued->link, &xwl_screen->queued_drm_lease_devices); } else {