Module: Mesa
Branch: main
Commit: 692a4b18047a9549ec993c6bded598c5f0c06de0
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=692a4b18047a9549ec993c6bded598c5f0c06de0

Author: Boris Brezillon <[email protected]>
Date:   Thu Nov 30 11:15:10 2023 +0100

panfrost: Don't leak NIR compute shaders

We never steal the NIR program or free it explicitly, and the state
tracker expects drivers to take ownership of the program object. Since
panfrost doesn't need to keep the original NIR shader around for
compute, let's just free it before returning.

Fixes: 40372bd720fe ("panfrost: Implement a disk cache")
Cc: stable
Signed-off-by: Boris Brezillon <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26424>

---

 src/gallium/drivers/panfrost/pan_shader.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/drivers/panfrost/pan_shader.c 
b/src/gallium/drivers/panfrost/pan_shader.c
index 42bb2f72768..546910f8e66 100644
--- a/src/gallium/drivers/panfrost/pan_shader.c
+++ b/src/gallium/drivers/panfrost/pan_shader.c
@@ -470,6 +470,7 @@ panfrost_create_compute_state(struct pipe_context *pctx,
    /* The NIR becomes invalid after this. For compute kernels, we never
     * need to access it again. Don't keep a dangling pointer around.
     */
+   ralloc_free((void *)so->nir);
    so->nir = NULL;
 
    return so;

Reply via email to