From 23fd2bd19fc082c4210c27b6284f16c07bbd45e8 Mon Sep 17 00:00:00 2001 From: stefan11111 Date: Wed, 5 Nov 2025 01:52:15 +0200 Subject: [PATCH] glamor: Set `*num_formats` to `NULL` in `glamor_get_formats` if we don't have any formats. Signed-off-by: stefan11111 --- glamor/glamor_egl.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c index 672d7f0f35..bb30bbe040 100644 --- a/glamor/glamor_egl.c +++ b/glamor/glamor_egl.c @@ -786,10 +786,12 @@ glamor_get_formats(ScreenPtr screen, #ifdef GLAMOR_HAS_EGL_QUERY_DMABUF struct glamor_egl_screen_private *glamor_egl; EGLint num; +#endif - /* Explicitly zero the count as the caller may ignore the return value */ + /* Explicitly zero the count and formats as the caller may ignore the return value */ *num_formats = 0; - + *formats = NULL; +#ifdef GLAMOR_HAS_EGL_QUERY_DMABUF glamor_egl = glamor_egl_get_screen_private(xf86ScreenToScrn(screen)); if (!glamor_egl->dmabuf_capable) @@ -812,11 +814,8 @@ glamor_get_formats(ScreenPtr screen, } *num_formats = num; - return TRUE; -#else - *num_formats = 0; - return TRUE; #endif + return TRUE; } Bool