[Mesa-dev] [PATCH 06/23] i965: Free serialized nir after deserializing

Timothy Arceri tarceri at itsqueeze.com
Wed Nov 29 01:24:42 UTC 2017


From: Jordan Justen <jordan.l.justen at intel.com>

Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
---
 src/mesa/drivers/dri/i965/brw_program.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index 2a647cdd734..30cc14e88a2 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -793,11 +793,17 @@ brw_program_deserialize_nir(struct gl_context *ctx, struct gl_program *prog,
 {
    if (!prog->nir) {
       assert(prog->driver_cache_blob && prog->driver_cache_blob_size > 0);
       const struct nir_shader_compiler_options *options =
          ctx->Const.ShaderCompilerOptions[stage].NirOptions;
       struct blob_reader reader;
       blob_reader_init(&reader, prog->driver_cache_blob,
                        prog->driver_cache_blob_size);
       prog->nir = nir_deserialize(NULL, options, &reader);
    }
+
+   if (prog->driver_cache_blob) {
+      ralloc_free(prog->driver_cache_blob);
+      prog->driver_cache_blob = NULL;
+      prog->driver_cache_blob_size = 0;
+   }
 }
-- 
2.14.3



More information about the mesa-dev mailing list