Tests: fix: leak of rate policy in rate policy unit tests
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 15 Apr 2022 00:09:24 +0000 (20:09 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 15 Apr 2022 03:46:02 +0000 (23:46 -0400)
==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 <jeremie.galarneau@efficios.com>
Change-Id: I3a9b4d99e93f355ddb8623a289f8397907486ab0

tests/unit/test_rate_policy.cpp

index 95c095f5a0bd6720a25663e6a28d679fd43a5349..6977ea8025ee17bbe4adca451418f65b461987c7 100644 (file)
@@ -131,6 +131,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);
 }
 
@@ -240,6 +241,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);
 }
 
This page took 0.02549 seconds and 4 git commands to generate.