shader: free stale sampler_arrays in sinfo (v2)

Fixes the mem leak:

Direct leak of 8 byte(s) in 1 object(s) allocated from:
    #0 0x7f49a7733c60 in realloc (/usr/lib64/gcc/x86_64-pc-linux-gnu/7.3.0/libasan.so+0xdbc60)
    #1 0x7f49a713100a in add_sampler_array ../../../../virgl-gitlab/src/vrend_shader.c:619
    #2 0x7f49a71318cb in add_samplers ../../../../virgl-gitlab/src/vrend_shader.c:677
    #3 0x7f49a713a780 in iter_declaration ../../../../virgl-gitlab/src/vrend_shader.c:1213
    #4 0x7f49a7194c37 in tgsi_iterate_shader ../../../../../../virgl-gitlab/src/gallium/auxiliary/tgsi/tgsi_iterate.c:59
    #5 0x7f49a7169a24 in vrend_convert_shader ../../../../virgl-gitlab/src/vrend_shader.c:5012

Closes: #85

[airlied: v2: free image arrays as well]

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
macos/master
Gert Wollny 6 years ago committed by Dave Airlie
parent ff18dfe508
commit ec56cc4a5d
  1. 4
      src/vrend_shader.c

@ -5098,8 +5098,12 @@ char *vrend_convert_shader(struct vrend_context *rctx,
sinfo->so_names = ctx.so_names;
sinfo->attrib_input_mask = ctx.attrib_input_mask;
if (sinfo->sampler_arrays)
free(sinfo->sampler_arrays);
sinfo->sampler_arrays = ctx.sampler_arrays;
sinfo->num_sampler_arrays = ctx.num_sampler_arrays;
if (sinfo->image_arrays)
free(sinfo->image_arrays);
sinfo->image_arrays = ctx.image_arrays;
sinfo->num_image_arrays = ctx.num_image_arrays;
return glsl_final;

Loading…
Cancel
Save