anv/pipeline: Ralloc prog_data::param of the compile mem_ctx
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 29 Sep 2017 17:06:17 +0000 (10:06 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 13 Oct 2017 05:39:30 +0000 (22:39 -0700)
This way we stop leaking it.  This is completely safe because, when we
hand it off to anv_shader_bin_create or anv_pipeline_cache_upload_kernel,
they make a copy of the entire param array.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/intel/vulkan/anv_pipeline.c

index be67392625ba9f26debd4a6b43f270e7029f377c..1e81edd390cbfa43c21d01a1c5fba26ad3a1d0b0 100644 (file)
@@ -417,8 +417,7 @@ anv_pipeline_compile(struct anv_pipeline *pipeline,
       pipeline->needs_data_cache = true;
 
    if (prog_data->nr_params > 0) {
-      /* XXX: I think we're leaking this */
-      prog_data->param = malloc(prog_data->nr_params * sizeof(uint32_t));
+      prog_data->param = ralloc_array(mem_ctx, uint32_t, prog_data->nr_params);
 
       /* We now set the param values to be offsets into a
        * anv_push_constant_data structure.  Since the compiler doesn't