Skip to content
Snippets Groups Projects
Commit f2b72b6f authored by Emma Anholt's avatar Emma Anholt Committed by Dylan Baker
Browse files

gallium/util: Fix incorrect refcounting of separate stencil.


The driver may have a reference on the separate stencil buffer for some
reason (like an unflushed job using it), so we can't directly free the
resource and should instead just decrement the refcount that we own.
Fixes double-free in KHR-GLES3.packed_depth_stencil.blit.depth32f_stencil8
on vc5.

Fixes: e94eb5e6 ("gallium/util: add u_transfer_helper")
Reviewed-by: default avatarRob Clark <robdclark@gmail.com>
(cherry picked from commit 069c409f)
parent d7650729
No related branches found
No related tags found
Loading
......@@ -138,8 +138,7 @@ u_transfer_helper_resource_destroy(struct pipe_screen *pscreen,
if (helper->vtbl->get_stencil) {
struct pipe_resource *stencil = helper->vtbl->get_stencil(prsc);
if (stencil)
helper->vtbl->resource_destroy(pscreen, stencil);
pipe_resource_reference(&stencil, NULL);
}
helper->vtbl->resource_destroy(pscreen, prsc);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment