Skip to content

radeonsi: fix memory leak related to ureg_get_tokens()

Patrick Lerda requested to merge noblock/mesa:radeonsileakureggettokens into main

Indeed, ureg_get_tokens() returns an allocated string that should be freed using ureg_free_tokens().

For instance, with "piglit/bin/arb_shader_image_load_store-invalid -auto -fbo"

Direct leak of 768 byte(s) in 2 object(s) allocated from:
    #0 0x7fa819a78b48 in __interceptor_realloc (/usr/lib64/libasan.so.6+0xb1b48)
    #1 0x7fa80e189e04 in tokens_expand ../src/gallium/auxiliary/tgsi/tgsi_ureg.c:239
    #2 0x7fa80e189e04 in get_tokens ../src/gallium/auxiliary/tgsi/tgsi_ureg.c:262
    #3 0x7fa80e191f6e in copy_instructions ../src/gallium/auxiliary/tgsi/tgsi_ureg.c:2079
    #4 0x7fa80e191f6e in ureg_finalize ../src/gallium/auxiliary/tgsi/tgsi_ureg.c:2129
    #5 0x7fa80e19447b in ureg_get_tokens ../src/gallium/auxiliary/tgsi/tgsi_ureg.c:2206
    #6 0x7fa80ec68b91 in si_create_fmask_expand_cs ../src/gallium/drivers/radeonsi/si_shaderlib_tgsi.c:564

Signed-off-by: Patrick Lerda patrick9876@free.fr

Merge request reports