From bae46a81520110e52c5af423ce712b9099fe23dd Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Fri, 9 Apr 2021 12:04:13 -0400 Subject: [PATCH] Fix: sessiond: fix memory leak in receive_lttng_trigger MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit After adding a trigger, ASan reports this when exiting the sessiond: Direct leak of 128 byte(s) in 1 object(s) allocated from: #0 0x7ffff767783a in __interceptor_realloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:164 #1 0x55555579a415 in lttng_dynamic_buffer_set_capacity /home/simark/src/lttng-tools/src/common/dynamic-buffer.c:166 #2 0x55555579a1df in lttng_dynamic_buffer_set_size /home/simark/src/lttng-tools/src/common/dynamic-buffer.c:118 #3 0x5555556d3cc1 in receive_lttng_trigger /home/simark/src/lttng-tools/src/bin/lttng-sessiond/client.c:712 #4 0x5555556dba46 in process_client_msg /home/simark/src/lttng-tools/src/bin/lttng-sessiond/client.c:2154 #5 0x5555556deef7 in thread_manage_clients /home/simark/src/lttng-tools/src/bin/lttng-sessiond/client.c:2601 #6 0x5555556c8a83 in launch_thread /home/simark/src/lttng-tools/src/bin/lttng-sessiond/thread.c:66 #7 0x7ffff714c298 in start_thread (/usr/lib/libpthread.so.0+0x9298) It seems like we don't free the payload in receive_lttng_trigger, fix that. Change-Id: Ie9bc3bad24fb55b98c8232c0cd63483a3e94bfb0 Signed-off-by: Simon Marchi Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/client.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bin/lttng-sessiond/client.c b/src/bin/lttng-sessiond/client.c index c9ff2ec70..d83bee8e6 100644 --- a/src/bin/lttng-sessiond/client.c +++ b/src/bin/lttng-sessiond/client.c @@ -776,6 +776,7 @@ static enum lttng_error_code receive_lttng_trigger(struct command_ctx *cmd_ctx, ret_code = LTTNG_OK; end: + lttng_payload_reset(&trigger_payload); return ret_code; } -- 2.34.1