From b3313b7f395983482d6efc60db039ef7a97cd6e0 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Sat, 30 Jun 2018 10:58:22 +0900 Subject: [PATCH] wlr_output: fix scope for 'now' 'when' points to now that was defined in the if, so compiler could reuse that memory area by the time 'when' is called Found through static analysis. --- types/wlr_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/wlr_output.c b/types/wlr_output.c index 40332efd..9f13bef4 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -486,8 +486,8 @@ bool wlr_output_swap_buffers(struct wlr_output *output, struct timespec *when, pixman_region32_intersect(&render_damage, &render_damage, damage); } + struct timespec now; if (when == NULL) { - struct timespec now; clock_gettime(CLOCK_MONOTONIC, &now); when = &now; }