Skip to content

Draft: shader: don't double-allocate the so_names

Test what makes !1313 (merged) fail.

In geometry shaders emit_so_movs is called for each TGSI_OPCODE_EMIT, which may result in allocating the name for the emitted TF output more than once. Make sure we only allocate the name once.

Fixes memory leak: Direct leak of 252 byte(s) in 36 object(s) allocated from: #0 0x55f1147d0290 in strdup /var/tmp/portage/sys-libs/compiler-rt-sanitizers-16.0.6/work/compiler-rt/lib/asan/asan_interceptors.cpp:475:3 #1 (closed) 0x7f7b0fedbb3c in emit_so_movs /home/gerddie/Collabora/virglrenderer/build-clang/../src/vrend_shader.c:2384:29 #2 (closed) 0x7f7b0fea0870 in iter_instruction /home/gerddie/Collabora/virglrenderer/build-clang/../src/vrend_shader.c:5948:13 #3 (closed) 0x7f7b1030cd26 in tgsi_iterate_shader /home/gerddie/Collabora/virglrenderer/build-clang/../src/gallium/auxiliary/tgsi/tgsi_iterate.c:54:18 #4 (closed) 0x7f7b0fe91fa2 in vrend_convert_shader /home/gerddie/Collabora/virglrenderer/build-clang/../src/vrend_shader.c:8168:11 #5 (closed) 0x7f7b0fe73a2c in vrend_shader_create /home/gerddie/Collabora/virglrenderer/build-clang/../src/vrend_renderer.c:4327:18 #6 (closed) 0x7f7b0fe1b631 in vrend_shader_select /home/gerddie/Collabora/virglrenderer/build-clang/../src/vrend_renderer.c:4377:11 #7 (closed) 0x7f7b0fe622c0 in vrend_finish_shader /home/gerddie/Collabora/virglrenderer/build-clang/../src/vrend_renderer.c:4420:11 #8 (closed) 0x7f7b0fe00c0a in vrend_shader_assign_tgsi /home/gerddie/Collabora/virglrenderer/build-clang/../src/vrend_renderer.c:4444:8 #9 (closed) 0x7f7b0fdff9a0 in vrend_create_shader /home/gerddie/Collabora/virglrenderer/build-clang/../src/vrend_renderer.c:4568:20 #10 (closed) 0x7f7b0fde51e0 in vrend_decode_create_shader /home/gerddie/Collabora/virglrenderer/build-clang/../src/vrend_decode.c:136:10 #11 (closed) 0x7f7b0fdd7430 in vrend_decode_create_object /home/gerddie/Collabora/virglrenderer/build-clang/../src/vrend_decode.c:865:13 #12 (closed) 0x7f7b0fdd6e8d in vrend_decode_ctx_submit_cmd /home/gerddie/Collabora/virglrenderer/build-clang/../src/vrend_decode.c:2055:13 #13 (closed) 0x7f7b0fdc7b45 in virgl_renderer_submit_cmd /home/gerddie/Collabora/virglrenderer/build-clang/../src/virglrenderer.c:299:11 #14 (closed) 0x55f114837935 in vtest_submit_cmd /home/gerddie/Collabora/virglrenderer/build-clang/../vtest/vtest_renderer.c:1273:10 #15 (closed) 0x55f11482d365 in vtest_client_dispatch_commands /home/gerddie/Collabora/virglrenderer/build-clang/../vtest/vtest_server.c:757:10 #16 (closed) 0x55f11482bc97 in vtest_server_dispatch_clients /home/gerddie/Collabora/virglrenderer/build-clang/../vtest/vtest_server.c:526:13 #17 (closed) 0x55f11482a24c in vtest_server_run /home/gerddie/Collabora/virglrenderer/build-clang/../vtest/vtest_server.c:636:7 #18 (closed) 0x55f1148291c4 in vtest_main /home/gerddie/Collabora/virglrenderer/build-clang/../vtest/vtest_server.c:153:4 #19 (closed) 0x55f114829113 in main /home/gerddie/Collabora/virglrenderer/build-clang/../vtest/vtest_main.c:28:12

v2: remove no-op free call (Ryan)

Signed-off-by: Gert Wollny gert.wollny@collabora.com

Merge request reports

Loading