libweston: do not forget to destroy temporary drm_format_array

Leak found running drm-formats-test with ASan:

==58755==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7fae74658459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7fae744dbe3a in zalloc ../include/libweston/zalloc.h:38
    #2 0x7fae744dbe4e in weston_drm_format_array_create ../libweston/drm-formats.c:44
    #3 0x7fae744dd2a2 in weston_drm_format_array_subtract ../libweston/drm-formats.c:410
    #4 0x55723c67bed5 in subtract_arrays ../tests/drm-formats-test.c:487
    #5 0x55723c67b6bb in wrapsubtract_arrays ../tests/drm-formats-test.c:467
    #6 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
    #7 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
    #8 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
    #9 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
    #10 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
    #11 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
    #12 0x55723c680844 in main ../tests/weston-test-runner.c:661
    #13 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #14 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7fae74658459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7fae744dbe3a in zalloc ../include/libweston/zalloc.h:38
    #2 0x7fae744dbe4e in weston_drm_format_array_create ../libweston/drm-formats.c:44
    #3 0x7fae744dd2a2 in weston_drm_format_array_subtract ../libweston/drm-formats.c:410
    #4 0x55723c67deca in subtract_arrays_modifier_invalid ../tests/drm-formats-test.c:613
    #5 0x55723c67da3d in wrapsubtract_arrays_modifier_invalid ../tests/drm-formats-test.c:593
    #6 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
    #7 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
    #8 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
    #9 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
    #10 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
    #11 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
    #12 0x55723c680844 in main ../tests/weston-test-runner.c:661
    #13 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #14 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7fae74658459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7fae744dbe3a in zalloc ../include/libweston/zalloc.h:38
    #2 0x7fae744dbe4e in weston_drm_format_array_create ../libweston/drm-formats.c:44
    #3 0x7fae744dd2a2 in weston_drm_format_array_subtract ../libweston/drm-formats.c:410
    #4 0x55723c67c9c0 in subtract_arrays_same_content ../tests/drm-formats-test.c:521
    #5 0x55723c67c55b in wrapsubtract_arrays_same_content ../tests/drm-formats-test.c:504
    #6 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
    #7 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
    #8 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
    #9 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
    #10 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
    #11 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
    #12 0x55723c680844 in main ../tests/weston-test-runner.c:661
    #13 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #14 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7fae74658459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7fae744dbe3a in zalloc ../include/libweston/zalloc.h:38
    #2 0x7fae744dbe4e in weston_drm_format_array_create ../libweston/drm-formats.c:44
    #3 0x7fae744dd2a2 in weston_drm_format_array_subtract ../libweston/drm-formats.c:410
    #4 0x55723c67d1b7 in subtract_arrays_exclusive_formats ../tests/drm-formats-test.c:552
    #5 0x55723c67cb23 in wrapsubtract_arrays_exclusive_formats ../tests/drm-formats-test.c:529
    #6 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
    #7 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
    #8 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
    #9 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
    #10 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
    #11 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
    #12 0x55723c680844 in main ../tests/weston-test-runner.c:661
    #13 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #14 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7fae74658459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7fae744dbe3a in zalloc ../include/libweston/zalloc.h:38
    #2 0x7fae744dbe4e in weston_drm_format_array_create ../libweston/drm-formats.c:44
    #3 0x7fae744dd2a2 in weston_drm_format_array_subtract ../libweston/drm-formats.c:410
    #4 0x55723c67d8d5 in subtract_arrays_exclusive_modifiers ../tests/drm-formats-test.c:584
    #5 0x55723c67d31d in wrapsubtract_arrays_exclusive_modifiers ../tests/drm-formats-test.c:561
    #6 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
    #7 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
    #8 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
    #9 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
    #10 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
    #11 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
    #12 0x55723c680844 in main ../tests/weston-test-runner.c:661
    #13 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #14 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)

Indirect leak of 320 byte(s) in 5 object(s) allocated from:
    #0 0x7fae74658279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7fae74473bc3 in wl_array_add (/usr/lib/libwayland-client.so.0+0xabc3)
    #2 0x7fae74473c10 in wl_array_copy (/usr/lib/libwayland-client.so.0+0xac10)
    #3 0x7fae744dbfe0 in add_format_and_modifiers ../libweston/drm-formats.c:108
    #4 0x7fae744dd389 in weston_drm_format_array_subtract ../libweston/drm-formats.c:418
    #5 0x55723c67d1b7 in subtract_arrays_exclusive_formats ../tests/drm-formats-test.c:552
    #6 0x55723c67cb23 in wrapsubtract_arrays_exclusive_formats ../tests/drm-formats-test.c:529
    #7 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
    #8 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
    #9 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
    #10 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
    #11 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
    #12 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
    #13 0x55723c680844 in main ../tests/weston-test-runner.c:661
    #14 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #15 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)

Indirect leak of 256 byte(s) in 1 object(s) allocated from:
    #0 0x7fae74658652 in __interceptor_realloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:164
    #1 0x7fae74473b76 in wl_array_add (/usr/lib/libwayland-client.so.0+0xab76)
    #2 0x7fae744dc19f in weston_drm_format_array_add_format ../libweston/drm-formats.c:166
    #3 0x7fae744dbfb7 in add_format_and_modifiers ../libweston/drm-formats.c:104
    #4 0x7fae744dd389 in weston_drm_format_array_subtract ../libweston/drm-formats.c:418
    #5 0x55723c67d1b7 in subtract_arrays_exclusive_formats ../tests/drm-formats-test.c:552
    #6 0x55723c67cb23 in wrapsubtract_arrays_exclusive_formats ../tests/drm-formats-test.c:529
    #7 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
    #8 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
    #9 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
    #10 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
    #11 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
    #12 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
    #13 0x55723c680844 in main ../tests/weston-test-runner.c:661
    #14 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #15 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)

Indirect leak of 256 byte(s) in 1 object(s) allocated from:
    #0 0x7fae74658652 in __interceptor_realloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:164
    #1 0x7fae74473b76 in wl_array_add (/usr/lib/libwayland-client.so.0+0xab76)
    #2 0x7fae744dc19f in weston_drm_format_array_add_format ../libweston/drm-formats.c:166
    #3 0x7fae744dd3de in weston_drm_format_array_subtract ../libweston/drm-formats.c:426
    #4 0x55723c67bed5 in subtract_arrays ../tests/drm-formats-test.c:487
    #5 0x55723c67b6bb in wrapsubtract_arrays ../tests/drm-formats-test.c:467
    #6 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
    #7 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
    #8 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
    #9 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
    #10 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
    #11 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
    #12 0x55723c680844 in main ../tests/weston-test-runner.c:661
    #13 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #14 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)

Indirect leak of 128 byte(s) in 2 object(s) allocated from:
    #0 0x7fae74658279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7fae74473bc3 in wl_array_add (/usr/lib/libwayland-client.so.0+0xabc3)
    #2 0x7fae74473c10 in wl_array_copy (/usr/lib/libwayland-client.so.0+0xac10)
    #3 0x7fae744dbfe0 in add_format_and_modifiers ../libweston/drm-formats.c:108
    #4 0x7fae744dd389 in weston_drm_format_array_subtract ../libweston/drm-formats.c:418
    #5 0x55723c67bed5 in subtract_arrays ../tests/drm-formats-test.c:487
    #6 0x55723c67b6bb in wrapsubtract_arrays ../tests/drm-formats-test.c:467
    #7 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
    #8 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
    #9 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
    #10 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
    #11 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
    #12 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
    #13 0x55723c680844 in main ../tests/weston-test-runner.c:661
    #14 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #15 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)

Indirect leak of 96 byte(s) in 3 object(s) allocated from:
    #0 0x7fae74658652 in __interceptor_realloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:164
    #1 0x7fae74473b76 in wl_array_add (/usr/lib/libwayland-client.so.0+0xab76)
    #2 0x7fae744dd142 in modifiers_subtract ../libweston/drm-formats.c:384
    #3 0x7fae744dd408 in weston_drm_format_array_subtract ../libweston/drm-formats.c:431
    #4 0x55723c67bed5 in subtract_arrays ../tests/drm-formats-test.c:487
    #5 0x55723c67b6bb in wrapsubtract_arrays ../tests/drm-formats-test.c:467
    #6 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
    #7 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
    #8 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
    #9 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
    #10 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
    #11 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
    #12 0x55723c680844 in main ../tests/weston-test-runner.c:661
    #13 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #14 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)

Indirect leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x7fae74658652 in __interceptor_realloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:164
    #1 0x7fae74473b76 in wl_array_add (/usr/lib/libwayland-client.so.0+0xab76)
    #2 0x7fae744dd142 in modifiers_subtract ../libweston/drm-formats.c:384
    #3 0x7fae744dd408 in weston_drm_format_array_subtract ../libweston/drm-formats.c:431
    #4 0x55723c67d8d5 in subtract_arrays_exclusive_modifiers ../tests/drm-formats-test.c:584
    #5 0x55723c67d31d in wrapsubtract_arrays_exclusive_modifiers ../tests/drm-formats-test.c:561
    #6 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
    #7 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
    #8 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
    #9 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
    #10 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
    #11 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
    #12 0x55723c680844 in main ../tests/weston-test-runner.c:661
    #13 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #14 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)

Indirect leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x7fae74658279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7fae74473bc3 in wl_array_add (/usr/lib/libwayland-client.so.0+0xabc3)
    #2 0x7fae744dc19f in weston_drm_format_array_add_format ../libweston/drm-formats.c:166
    #3 0x7fae744dd3de in weston_drm_format_array_subtract ../libweston/drm-formats.c:426
    #4 0x55723c67d8d5 in subtract_arrays_exclusive_modifiers ../tests/drm-formats-test.c:584
    #5 0x55723c67d31d in wrapsubtract_arrays_exclusive_modifiers ../tests/drm-formats-test.c:561
    #6 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
    #7 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
    #8 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
    #9 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
    #10 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
    #11 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
    #12 0x55723c680844 in main ../tests/weston-test-runner.c:661
    #13 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #14 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)

Indirect leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x7fae74658279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7fae74473bc3 in wl_array_add (/usr/lib/libwayland-client.so.0+0xabc3)
    #2 0x7fae744dc19f in weston_drm_format_array_add_format ../libweston/drm-formats.c:166
    #3 0x7fae744dd3de in weston_drm_format_array_subtract ../libweston/drm-formats.c:426
    #4 0x55723c67deca in subtract_arrays_modifier_invalid ../tests/drm-formats-test.c:613
    #5 0x55723c67da3d in wrapsubtract_arrays_modifier_invalid ../tests/drm-formats-test.c:593
    #6 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
    #7 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
    #8 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
    #9 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
    #10 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
    #11 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
    #12 0x55723c680844 in main ../tests/weston-test-runner.c:661
    #13 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #14 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)

Indirect leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x7fae74658279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7fae74473bc3 in wl_array_add (/usr/lib/libwayland-client.so.0+0xabc3)
    #2 0x7fae744dc19f in weston_drm_format_array_add_format ../libweston/drm-formats.c:166
    #3 0x7fae744dd3de in weston_drm_format_array_subtract ../libweston/drm-formats.c:426
    #4 0x55723c67c9c0 in subtract_arrays_same_content ../tests/drm-formats-test.c:521
    #5 0x55723c67c55b in wrapsubtract_arrays_same_content ../tests/drm-formats-test.c:504
    #6 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
    #7 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
    #8 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
    #9 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
    #10 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
    #11 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
    #12 0x55723c680844 in main ../tests/weston-test-runner.c:661
    #13 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #14 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This commit is contained in:
Leandro Ribeiro 2021-06-15 17:29:29 -03:00 committed by Pekka Paalanen
parent 819054ceac
commit 0157591b34

View File

@ -440,6 +440,7 @@ weston_drm_format_array_subtract(struct weston_drm_format_array *formats_A,
if (ret < 0)
goto err;
weston_drm_format_array_destroy(formats_result);
return 0;
err: