Tests: fix: leak of trigger in trigger listing tests
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 15 Apr 2022 03:26:12 +0000 (23:26 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 15 Apr 2022 03:46:04 +0000 (23:46 -0400)
==1480456==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 112 byte(s) in 1 object(s) allocated from:
    #0 0x7fdb9260cfb9 in __interceptor_calloc /usr/src/debug/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7fdb9242348d in zmalloc_internal ../../src/common/macros.hpp:60
    #2 0x7fdb924295a9 in lttng_trigger* zmalloc<lttng_trigger>() ../../src/common/macros.hpp:89
    #3 0x7fdb92423dbe in lttng_trigger_create /home/jgalar/EfficiOS/src/lttng-tools/src/common/trigger.cpp:58
    #4 0x56304832331f in register_trigger /home/jgalar/EfficiOS/src/lttng-tools/tests/regression/tools/trigger/utils/register-some-triggers.cpp:24
    #5 0x5630483233f1 in register_trigger_action_list_notify /home/jgalar/EfficiOS/src/lttng-tools/tests/regression/tools/trigger/utils/register-some-triggers.cpp:46
    #6 0x5630483239a0 in test_session_rotation_conditions /home/jgalar/EfficiOS/src/lttng-tools/tests/regression/tools/trigger/utils/register-some-triggers.cpp:246
    #7 0x563048323d4d in main /home/jgalar/EfficiOS/src/lttng-tools/tests/regression/tools/trigger/utils/register-some-triggers.cpp:309
    #8 0x7fdb91c6630f in __libc_start_call_main (/usr/lib/libc.so.6+0x2d30f)

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ie163989a70f65f9c2c4e93c36cc9fc6ba6bdeeb5

tests/regression/tools/trigger/utils/register-some-triggers.cpp

index cbcfbfb82baadc4b12bccad2bf157bba8286a4dc..6a173b7c18293430e9a5bd5fabd885ce9fdc7727 100644 (file)
@@ -24,6 +24,9 @@ static void register_trigger(const char *trigger_name,
        trigger = lttng_trigger_create(condition, action);
        ret = lttng_register_trigger_with_name(trigger, trigger_name);
        LTTNG_ASSERT(ret == LTTNG_OK);
+       lttng_trigger_destroy(trigger);
+       lttng_condition_destroy(condition);
+       lttng_action_destroy(action);
 }
 
 /*
@@ -42,6 +45,7 @@ static void register_trigger_action_list_notify(
        action_status = lttng_action_list_add_action(
                        action_list, action_notify);
        LTTNG_ASSERT(action_status == LTTNG_ACTION_STATUS_OK);
+       lttng_action_destroy(action_notify);
 
        register_trigger(trigger_name, condition, action_list);
 }
This page took 0.027748 seconds and 5 git commands to generate.