Skip to content

Commit cf7f7e7

Browse files
Patrick Lerda1ace
Patrick Lerda
authored andcommitted
r300: fix constants_remap_table memory leak
For instance, this issue is triggered with "piglit/bin/object-namespace-pollution glBitmap program -auto -fbo": Direct leak of 112 byte(s) in 7 object(s) allocated from: #0 0x7f472540e7ef in __interceptor_malloc (/usr/lib64/libasan.so.6+0xb17ef) #1 0x7f471a9ce18f in rc_remove_unused_constants ../src/gallium/drivers/r300/compiler/radeon_remove_constants.c:101 #2 0x7f471a9b0836 in rc_run_compiler_passes ../src/gallium/drivers/r300/compiler/radeon_compiler.c:476 #3 0x7f471a9b0ad5 in rc_run_compiler ../src/gallium/drivers/r300/compiler/radeon_compiler.c:498 #4 0x7f471a9ec862 in r3xx_compile_fragment_program ../src/gallium/drivers/r300/compiler/r3xx_fragprog.c:172 #5 0x7f471a9e1ab2 in r300_translate_fragment_shader ../src/gallium/drivers/r300/r300_fs.c:516 #6 0x7f471a9e6303 in r300_pick_fragment_shader ../src/gallium/drivers/r300/r300_fs.c:591 #7 0x7f471a9544fe in r300_create_fs_state ../src/gallium/drivers/r300/r300_state.c:1073 #8 0x7f4718f2ebe5 in st_create_fp_variant ../src/mesa/state_tracker/st_program.c:1070 #9 0x7f4718f374b5 in st_get_fp_variant ../src/mesa/state_tracker/st_program.c:1116 #10 0x7f4718f38273 in st_precompile_shader_variant ../src/mesa/state_tracker/st_program.c:1281 #11 0x7f4718f38273 in st_finalize_program ../src/mesa/state_tracker/st_program.c:1345 #12 0x7f4718f389e9 in st_program_string_notify ../src/mesa/state_tracker/st_program.c:1378 #13 0x7f47199d9f99 in set_program_string ../src/mesa/main/arbprogram.c:413 Fixes: 1c2c4dd ("r300g: copy the compiler from r300c") Signed-off-by: Patrick Lerda <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27957> (cherry picked from commit 29df857)
1 parent ebed52c commit cf7f7e7

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

.pick_status.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1404,7 +1404,7 @@
14041404
"description": "r300: fix constants_remap_table memory leak",
14051405
"nominated": true,
14061406
"nomination_type": 1,
1407-
"resolution": 0,
1407+
"resolution": 1,
14081408
"main_sha": null,
14091409
"because_sha": "1c2c4ddbd1e97bfd13430521e5c09cb5ce8e36e6",
14101410
"notes": null

src/gallium/drivers/r300/r300_state.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,6 +1119,8 @@ static void r300_delete_fs_state(struct pipe_context* pipe, void* shader)
11191119
struct r300_fragment_shader* fs = (struct r300_fragment_shader*)shader;
11201120
struct r300_fragment_shader_code *tmp, *ptr = fs->first;
11211121

1122+
free(fs->shader->code.constants_remap_table);
1123+
11221124
while (ptr) {
11231125
tmp = ptr;
11241126
ptr = ptr->next;

0 commit comments

Comments
 (0)