Skip to content

Commit 5c5c694

Browse files
committed
Fix: liblttng-ctl: leak of payload on field listing
LeakSanitizer reports the following leak: ==974957==ERROR: LeakSanitizer: detected memory leaks Direct leak of 32 byte(s) in 1 object(s) allocated from: #0 0x7fdb86fcd1b2 in __interceptor_realloc /usr/src/debug/gcc/libsanitizer/asan/asan_malloc_linux.cpp:164 #1 0x7fdb86d7c296 in lttng_dynamic_buffer_set_capacity(lttng_dynamic_buffer*, unsigned long) /home/jgalar/EfficiOS/src/lttng-tools/src/common/dynamic-buffer.cpp:159 #2 0x7fdb86d7c060 in lttng_dynamic_buffer_set_size(lttng_dynamic_buffer*, unsigned long) /home/jgalar/EfficiOS/src/lttng-tools/src/common/dynamic-buffer.cpp:112 #3 0x7fdb86d2589a in recv_payload_sessiond /home/jgalar/EfficiOS/src/lttng-tools/src/lib/lttng-ctl/lttng-ctl.cpp:230 #4 0x7fdb86d26fa5 in lttng_ctl_ask_sessiond_payload(lttng_payload_view*, lttng_payload*) /home/jgalar/EfficiOS/src/lttng-tools/src/lib/lttng-ctl/lttng-ctl.cpp:662 #5 0x7fdb86d2cd8d in lttng_list_tracepoint_fields /home/jgalar/EfficiOS/src/lttng-tools/src/lib/lttng-ctl/lttng-ctl.cpp:1767 #6 0x56481623cb4c in list_ust_event_fields commands/list.cpp:850 #7 0x5648162448d9 in cmd_list(int, char const**) commands/list.cpp:2394 #8 0x56481628fb3e in handle_command /home/jgalar/EfficiOS/src/lttng-tools/src/bin/lttng/lttng.cpp:238 lttng#9 0x564816290601 in parse_args /home/jgalar/EfficiOS/src/lttng-tools/src/bin/lttng/lttng.cpp:427 lttng#10 0x564816290908 in main /home/jgalar/EfficiOS/src/lttng-tools/src/bin/lttng/lttng.cpp:476 lttng#11 0x7fdb8661730f in __libc_start_call_main (/usr/lib/libc.so.6+0x2d30f) SUMMARY: AddressSanitizer: 32 byte(s) leaked in 1 allocation(s). The session daemon's reply is indeed never released in lttng_list_tracepoint_fields. Signed-off-by: Jérémie Galarneau <[email protected]> Change-Id: Idd244b52a69f3b74e5c131c1c36c6ee6d76f4285
1 parent f149493 commit 5c5c694

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/lib/lttng-ctl/lttng-ctl.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -1747,13 +1747,13 @@ int lttng_list_tracepoint_fields(struct lttng_handle *handle,
17471747
unsigned int nb_event_fields = 0;
17481748
struct lttng_payload reply;
17491749

1750+
lttng_payload_init(&reply);
1751+
17501752
if (handle == NULL) {
17511753
ret = -LTTNG_ERR_INVALID;
17521754
goto end;
17531755
}
17541756

1755-
lttng_payload_init(&reply);
1756-
17571757
memset(&lsm, 0, sizeof(lsm));
17581758
lsm.cmd_type = LTTNG_LIST_TRACEPOINT_FIELDS;
17591759
COPY_DOMAIN_PACKED(lsm.domain, handle->domain);
@@ -1807,6 +1807,7 @@ int lttng_list_tracepoint_fields(struct lttng_handle *handle,
18071807
ret = nb_event_fields;
18081808

18091809
end:
1810+
lttng_payload_reset(&reply);
18101811
return ret;
18111812
}
18121813

0 commit comments

Comments
 (0)