From 62ac324b10976685fbc75544949bfd95b1d08757 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 24 Feb 2025 13:58:25 +0100 Subject: [PATCH] xwayland: protect from memory allocation failure Signed-off-by: Enrico Weigelt, metux IT consult --- hw/xwayland/xwayland-drm-lease.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/xwayland/xwayland-drm-lease.c b/hw/xwayland/xwayland-drm-lease.c index cd810c4cc..6c0683a61 100644 --- a/hw/xwayland/xwayland-drm-lease.c +++ b/hw/xwayland/xwayland-drm-lease.c @@ -165,7 +165,8 @@ xwl_randr_request_lease(ClientPtr client, ScreenPtr screen, RRLeasePtr rrLease) req = wp_drm_lease_device_v1_create_lease_request( lease_device->drm_lease_device); - lease_private = calloc(1, sizeof(struct xwl_drm_lease)); + if (!(lease_private = calloc(1, sizeof(struct xwl_drm_lease)))) + return BadAlloc; for (i = 0; i < rrLease->numOutputs; ++i) { output = rrLease->outputs[i]->devPrivate; output->lease = lease_private;