Skip to content

Commit

Permalink
tests: fix leaks in drm-formats-test
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
leandrohrb authored and ppaalanen committed Jun 16, 2021
1 parent 0157591 commit 7c547e4
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions tests/drm-formats-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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. */
Expand Down

0 comments on commit 7c547e4

Please sign in to comment.