Fix: sessiond: fix memory leak in receive_lttng_trigger
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 9 Apr 2021 16:04:13 +0000 (12:04 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 13 Apr 2021 20:22:37 +0000 (16:22 -0400)
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 <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/client.c

index c9ff2ec70fa635ff6de188ef12bd70361be6e512..d83bee8e66441c8f6b9ddb08f8821ef83a468191 100644 (file)
@@ -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;
 }
 
This page took 0.027266 seconds and 4 git commands to generate.