tests: cpu-remap-test.c: fix memory leaks
authorEero Nurkkala <eero.nurkkala@offcode.fi>
Tue, 21 Jul 2020 08:22:39 +0000 (11:22 +0300)
committerEero Nurkkala <eero.nurkkala@offcode.fi>
Tue, 21 Jul 2020 11:57:05 +0000 (14:57 +0300)
commit1f1fb8eb6b3e9ce9a6d7b382f48ddb2349d98be6
tree62062b0d8f76b16da37078c4039c821442f59600
parent9dd7f48b4911cbf35ee1f4ddb4a04a930c7ef4f9
tests: cpu-remap-test.c: fix memory leaks

When compiled with ASAN: -O1 -fsanitize=address -fno-omit-frame-pointer,
the following issues are seen:

==17217==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x7fceba414b40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    #1 0x7fceb9b3eac9 in pa_xmalloc pulse/xmalloc.c:63
    #2 0x7fceb9b3ed22 in pa_xmemdup pulse/xmalloc.c:94
    #3 0x7fceb9e1eed5 in _pa_xnewdup_internal pulse/xmalloc.h:86
    #4 0x7fceb9e1eed5 in init_remap_c pulsecore/remap.c:580
    #5 0x7fceb9e1efe5 in pa_init_remap_func pulsecore/remap.c:608
    #6 0x5574e72422b7 in remap_init2_test_channels tests/cpu-remap-test.c:303
    #7 0x5574e7242420 in rearrange_special_test tests/cpu-remap-test.c:345
    #8 0x5574e7245ce5 in srunner_run (/home/eenurkka/pulse/pulseaudio/src/.libs/cpu-remap-test+0x9ce5)
...
SUMMARY: AddressSanitizer: 192 byte(s) leaked in 6 allocation(s).

Fix those issues by freeing the allocated resources properly.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
src/tests/cpu-remap-test.c