From 7561da367baeb49c848dc49b65e252deb6428422 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Mon, 16 Oct 2017 16:35:18 +0200 Subject: st/mesa: Initialize textures array in st_framebuffer_validate And just reference pipe_resources to it in the validate callbacks. Avoids pipe_resource leaks when st_framebuffer_validate ends up calling the validate callback multiple times, e.g. when a window is resized. v2: * Use generic stable tag instead of Fixes: tag, since the problem could already happen before the commit referenced in v1 (Thomas Hellstrom) * Use memset to initialize the array on the stack instead of allocating the array with os_calloc. Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Thomas Hellstrom --- src/gallium/state_trackers/osmesa/osmesa.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/gallium/state_trackers/osmesa/osmesa.c') diff --git a/src/gallium/state_trackers/osmesa/osmesa.c b/src/gallium/state_trackers/osmesa/osmesa.c index 2f9558db312..44a0cc43812 100644 --- a/src/gallium/state_trackers/osmesa/osmesa.c +++ b/src/gallium/state_trackers/osmesa/osmesa.c @@ -432,6 +432,7 @@ osmesa_st_framebuffer_validate(struct st_context_iface *stctx, templat.format = format; templat.bind = bind; + pipe_resource_reference(&out[i], NULL); out[i] = osbuffer->textures[statts[i]] = screen->resource_create(screen, &templat); } -- cgit v1.2.3