From d59e58bb794dead058e07cf2bdb13e8f88f7db3a Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Sat, 4 Apr 2026 07:33:51 +0300 Subject: [PATCH] compositor: Pass the length to opem_stream for one shot scene-graph Rather than passing a NULL use sizeloc to pass the size. Otherwise fflush(3) and fclose(3) would die out crashing in libc. Use size also when printing out to a subscriber. Fixes: e9665ef36 Signed-off-by: Marius Vlad --- libweston/compositor.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libweston/compositor.c b/libweston/compositor.c index 9437ff616..84e8999a0 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -9900,6 +9900,7 @@ debug_scene_graph_cb(struct weston_log_subscription *sub, void *data) struct weston_compositor *ec = data; FILE *fp; char *str; + size_t ret; /* If the presentation_clock is CLOCK_REALTIME, then it is * uninitialized. This means no back-end is loaded yet, so we can't @@ -9907,11 +9908,11 @@ debug_scene_graph_cb(struct weston_log_subscription *sub, void *data) if (ec->presentation_clock == CLOCK_REALTIME) return; - fp = open_memstream(&str, NULL); + fp = open_memstream(&str, &ret); weston_compositor_print_scene_graph(ec, fp); fclose(fp); - weston_log_subscription_write(sub, str, strlen(str)); + weston_log_subscription_write(sub, str, ret); free(str); weston_log_subscription_complete(sub);