From 55f15d1abd741efef63100a5104392487f3b88d0 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Thu, 7 Nov 2024 23:10:39 +0100 Subject: [PATCH] backend/drm: Ensure renderer is set to NULL on error If init_drm_renderer failed, it would destroy the renderer but would not set it to NULL, leading to use-after-free. NULL the renderer after destroying it. --- backend/drm/renderer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/drm/renderer.c b/backend/drm/renderer.c index 08ed62451..ce59c90a7 100644 --- a/backend/drm/renderer.c +++ b/backend/drm/renderer.c @@ -25,6 +25,7 @@ bool init_drm_renderer(struct wlr_drm_backend *drm, if (renderer->allocator == NULL) { wlr_log(WLR_ERROR, "Failed to create allocator"); wlr_renderer_destroy(renderer->wlr_rend); + renderer->wlr_rend = NULL; return false; }