From: John Lindgren Date: Fri, 4 Jul 2025 04:45:59 +0000 (-0400) Subject: session-lock: eliminate pointless compound literal X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=7d2b5150e81a2b85a949942d1f49eee356533ac5;p=proto%2Flabwc.git session-lock: eliminate pointless compound literal In C++, this would have caused a use-after-free. In C, the unnamed array remains in scope longer, so it's okay, but still pointless. --- diff --git a/src/session-lock.c b/src/session-lock.c index edad8f64..0a140ca6 100644 --- a/src/session-lock.c +++ b/src/session-lock.c @@ -216,7 +216,7 @@ session_lock_output_create(struct session_lock_manager *manager, struct output * * all outputs with an opaque color such that their normal content is * fully hidden */ - float *black = (float[4]) { 0.f, 0.f, 0.f, 1.f }; + float black[4] = { 0.f, 0.f, 0.f, 1.f }; struct wlr_scene_rect *background = wlr_scene_rect_create(tree, 0, 0, black); if (!background) { wlr_log(WLR_ERROR, "session-lock: wlr_scene_rect_create()");