]> git.mdlowis.com Git - proto/labwc.git/commitdiff
session-lock: eliminate pointless compound literal
authorJohn Lindgren <john@jlindgren.net>
Fri, 4 Jul 2025 04:45:59 +0000 (00:45 -0400)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Mon, 21 Jul 2025 14:51:10 +0000 (16:51 +0200)
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.

src/session-lock.c

index edad8f649abb9bac940002fd7418c7f7e871f4f3..0a140ca6a5a01859129dfd8d04c3937ae1882865 100644 (file)
@@ -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()");