[lttng-dev] [PATCH lttng-tools] Fix: use newly created event filter for condition check

Jonathan Rajotte jonathan.rajotte-julien at efficios.com
Tue Sep 24 10:53:16 EDT 2019


4c5e3185d75ffe90b04107744693964d9051fb6b introduced a regression while
fixing the filter and filter_expression ownership.

Setting the "filter" object to NULL prevents the call to
add_filter_app_ctx when needed.

We use the filter from the newly created event to
perform the check and the call to add_filter_app_ctx.

Fixes coverity #1399733

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
---
 src/bin/lttng-sessiond/event.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/bin/lttng-sessiond/event.c b/src/bin/lttng-sessiond/event.c
index f32db4429..a8b7646da 100644
--- a/src/bin/lttng-sessiond/event.c
+++ b/src/bin/lttng-sessiond/event.c
@@ -513,8 +513,9 @@ int event_agent_enable(struct ltt_ust_session *usess,
 		created = 1;
 	}
 
-	if (created && filter) {
-		ret = add_filter_app_ctx(filter, filter_expression, agt);
+	if (created && aevent->filter) {
+		ret = add_filter_app_ctx(
+				aevent->filter, aevent->filter_expression, agt);
 		if (ret != LTTNG_OK) {
 			goto error;
 		}
-- 
2.17.1



More information about the lttng-dev mailing list