tests: fix leaks in drm-formats-test

Leak found running drm-formats-test with ASan:

==59454==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7f5302ff2459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7f5302e75e3a in zalloc ../include/libweston/zalloc.h:38
    #2 0x7f5302e75e4e in weston_drm_format_array_create ../libweston/drm-formats.c:44
    #3 0x7f5302e76e33 in weston_drm_format_array_intersect ../libweston/drm-formats.c:340
    #4 0x559dc2d3c69f in intersect_arrays_same_content ../tests/drm-formats-test.c:391
    #5 0x559dc2d3c317 in wrapintersect_arrays_same_content ../tests/drm-formats-test.c:376
    #6 0x559dc2d409ec in run_test ../tests/weston-test-runner.c:162
    #7 0x559dc2d410f2 in run_case ../tests/weston-test-runner.c:277
    #8 0x559dc2d40e8b in for_each_test_case ../tests/weston-test-runner.c:235
    #9 0x559dc2d4139b in testsuite_run ../tests/weston-test-runner.c:311
    #10 0x559dc2d423c4 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
    #11 0x559dc2d423f4 in fixture_setup_run_ ../tests/weston-test-runner.c:610
    #12 0x559dc2d42887 in main ../tests/weston-test-runner.c:661
    #13 0x7f5302c5eb24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #14 0x559dc2d3642d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7f5302ff2459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7f5302e75e3a in zalloc ../include/libweston/zalloc.h:38
    #2 0x7f5302e75e4e in weston_drm_format_array_create ../libweston/drm-formats.c:44
    #3 0x559dc2d3bc7b in intersect_arrays ../tests/drm-formats-test.c:352
    #4 0x559dc2d3b678 in wrapintersect_arrays ../tests/drm-formats-test.c:339
    #5 0x559dc2d409ec in run_test ../tests/weston-test-runner.c:162
    #6 0x559dc2d410f2 in run_case ../tests/weston-test-runner.c:277
    #7 0x559dc2d40e8b in for_each_test_case ../tests/weston-test-runner.c:235
    #8 0x559dc2d4139b in testsuite_run ../tests/weston-test-runner.c:311
    #9 0x559dc2d423c4 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
    #10 0x559dc2d423f4 in fixture_setup_run_ ../tests/weston-test-runner.c:610
    #11 0x559dc2d42887 in main ../tests/weston-test-runner.c:661
    #12 0x7f5302c5eb24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #13 0x559dc2d3642d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
dev
Leandro Ribeiro 3 years ago committed by Pekka Paalanen
parent 0157591b34
commit 7c547e492c
  1. 4
      tests/drm-formats-test.c

@ -349,11 +349,9 @@ TEST(intersect_arrays)
format_array_A = weston_drm_format_array_create();
format_array_B = weston_drm_format_array_create();
format_array_C = weston_drm_format_array_create();
format_array_result = weston_drm_format_array_create();
assert(format_array_A);
assert(format_array_B);
assert(format_array_C);
assert(format_array_result);
ADD_FORMATS_AND_MODS(format_array_A, formats_A, modifiers_A);
ADD_FORMATS_AND_MODS(format_array_B, formats_B, modifiers_B);
@ -393,7 +391,7 @@ TEST(intersect_arrays_same_content)
assert(format_array_result);
assert(format_array_result->arr.size == 0);
weston_drm_format_array_fini(format_array_result);
weston_drm_format_array_destroy(format_array_result);
/* DRM-format arrays A and B have the same content, so the intersection
* should be equal to them. */

Loading…
Cancel
Save