From afc82f93ca3d316a3a61520c96249909a185b380 Mon Sep 17 00:00:00 2001 From: Francis Deslauriers Date: Fri, 7 May 2021 17:44:52 -0400 Subject: [PATCH] Fix: action-executor: leak of `work_item::subitems` field MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This leak can be reproduced by adding a trigger and looking at the used memory of the lttng-sessiond process. Valgrind reports the following leak: ==2472== 7,087,968 bytes in 147,666 blocks are definitely lost in loss record 24 of 24 ==2472== at 0x4C31B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==2472== by 0x191C37: zmalloc (macros.h:45) ==2472== by 0x195234: action_executor_enqueue_trigger (action-executor.c:913) ==2472== by 0x171AD7: dispatch_one_event_notifier_notification (notification-thread-events.c:4626) ==2472== by 0x171D1E: handle_one_event_notifier_notification (notification-thread-events.c:4715) ==2472== by 0x171DA4: handle_notification_thread_event_notification (notification-thread-events.c:4730) ==2472== by 0x164EA6: handle_event_notification_pipe (notification-thread.c:591) ==2472== by 0x1656C3: thread_notification (notification-thread.c:727) ==2472== by 0x17BD16: launch_thread (thread.c:66) ==2472== by 0x5F086DA: start_thread (pthread_create.c:463) ==2472== by 0x624188E: clone (clone.S:95) Signed-off-by: Francis Deslauriers Signed-off-by: Jérémie Galarneau Change-Id: I3d98e3ae18c5b2d7f400407842a7de17716f680c --- src/bin/lttng-sessiond/action-executor.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bin/lttng-sessiond/action-executor.c b/src/bin/lttng-sessiond/action-executor.c index a25993352..853146d3b 100644 --- a/src/bin/lttng-sessiond/action-executor.c +++ b/src/bin/lttng-sessiond/action-executor.c @@ -730,6 +730,7 @@ static void action_work_item_destroy(struct action_work_item *work_item) lttng_evaluation_destroy(work_item->evaluation); notification_client_list_put(work_item->client_list); lttng_dynamic_array_reset(work_item->subitems); + free(work_item->subitems); free(work_item); } -- 2.34.1