From: Jérémie Galarneau Date: Fri, 15 Apr 2022 00:09:24 +0000 (-0400) Subject: Tests: fix: leak of rate policy in rate policy unit tests X-Git-Tag: v2.13.8~22 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=c48dc333178b8f4edf49cf9c496824ccf4248a3a;p=lttng-tools.git Tests: fix: leak of rate policy in rate policy unit tests ==1198508==ERROR: LeakSanitizer: detected memory leaks Direct leak of 56 byte(s) in 1 object(s) allocated from: #0 0x7f8b62634fb9 in __interceptor_calloc /usr/src/debug/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154 #1 0x557871869adb in zmalloc_internal ../../src/common/macros.hpp:60 #2 0x55787186c8a0 in zmalloc<(anonymous namespace)::lttng_rate_policy_once_after_n> ../../src/common/macros.hpp:89 #3 0x55787186c173 in lttng_rate_policy_once_after_n_create actions/rate-policy.cpp:707 #4 0x55787186a368 in lttng_rate_policy_once_after_n_create_from_payload actions/rate-policy.cpp:183 #5 0x55787186ad02 in lttng_rate_policy_create_from_payload(lttng_payload_view*, lttng_rate_policy**) actions/rate-policy.cpp:287 #6 0x557871865b5b in test_rate_policy_once_after_n /home/jgalar/EfficiOS/src/lttng-tools/tests/unit/test_rate_policy.cpp:231 #7 0x557871865dc9 in main /home/jgalar/EfficiOS/src/lttng-tools/tests/unit/test_rate_policy.cpp:250 #8 0x7f8b61c7130f in __libc_start_call_main (/usr/lib/libc.so.6+0x2d30f) Direct leak of 56 byte(s) in 1 object(s) allocated from: #0 0x7f8b62634fb9 in __interceptor_calloc /usr/src/debug/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154 #1 0x557871869adb in zmalloc_internal ../../src/common/macros.hpp:60 #2 0x55787186c890 in zmalloc<(anonymous namespace)::lttng_rate_policy_every_n> ../../src/common/macros.hpp:89 #3 0x55787186b6cd in lttng_rate_policy_every_n_create actions/rate-policy.cpp:492 #4 0x55787186a699 in lttng_rate_policy_every_n_create_from_payload actions/rate-policy.cpp:220 #5 0x55787186ad02 in lttng_rate_policy_create_from_payload(lttng_payload_view*, lttng_rate_policy**) actions/rate-policy.cpp:287 #6 0x557871864cae in test_rate_policy_every_n /home/jgalar/EfficiOS/src/lttng-tools/tests/unit/test_rate_policy.cpp:122 #7 0x557871865dc4 in main /home/jgalar/EfficiOS/src/lttng-tools/tests/unit/test_rate_policy.cpp:249 #8 0x7f8b61c7130f in __libc_start_call_main (/usr/lib/libc.so.6+0x2d30f) SUMMARY: AddressSanitizer: 112 byte(s) leaked in 2 allocation(s). Signed-off-by: Jérémie Galarneau Change-Id: I3a9b4d99e93f355ddb8623a289f8397907486ab0 --- diff --git a/tests/unit/test_rate_policy.c b/tests/unit/test_rate_policy.c index fcb27733c..2f4a7f5d6 100644 --- a/tests/unit/test_rate_policy.c +++ b/tests/unit/test_rate_policy.c @@ -132,6 +132,7 @@ static void test_rate_policy_every_n(void) lttng_rate_policy_destroy(policy_a); lttng_rate_policy_destroy(policy_b); lttng_rate_policy_destroy(policy_c); + lttng_rate_policy_destroy(policy_from_buffer); lttng_payload_reset(&payload); } @@ -241,6 +242,7 @@ static void test_rate_policy_once_after_n(void) lttng_rate_policy_destroy(policy_a); lttng_rate_policy_destroy(policy_b); lttng_rate_policy_destroy(policy_c); + lttng_rate_policy_destroy(policy_from_buffer); lttng_payload_reset(&payload); }