radeonsi: fix memory leak related to ureg_get_tokens()
authorPatrick Lerda <patrick9876@free.fr>
Wed, 8 Mar 2023 16:20:22 +0000 (17:20 +0100)
committerMarge Bot <emma+marge@anholt.net>
Wed, 15 Mar 2023 06:41:28 +0000 (06:41 +0000)
commitaba16defa842ef3559fb29c6f9c4d347895b9b3a
tree6b1a5607b11d4072123b056aa338d808cbf71e9c
parent040dc89b95dcb7eef5b191dc89bed309747a1d11
radeonsi: fix memory leak related to ureg_get_tokens()

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>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21871>
src/gallium/drivers/radeonsi/si_shaderlib_tgsi.c