From 6fe2a7d00ab34f9a4db653c04819cd465fefa196 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Wed, 25 Sep 2019 17:06:23 -0400 Subject: [PATCH] sessiond: clean-up: silence warning that agent event is leaked MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Both Coverity and scan-build got confused by this function. Essentially, they warn that aevent can be leaked if it is created in an already enabled state. We know that this can't happen as the events are created in a disabled state. Add an assert that created events are not enabled to help the static analyzers. This could also catch the leak should this change in the future. Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/event.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bin/lttng-sessiond/event.c b/src/bin/lttng-sessiond/event.c index a8b7646da..e687caf86 100644 --- a/src/bin/lttng-sessiond/event.c +++ b/src/bin/lttng-sessiond/event.c @@ -511,6 +511,7 @@ int event_agent_enable(struct ltt_ust_session *usess, filter = NULL; filter_expression = NULL; created = 1; + assert(!aevent->enabled); } if (created && aevent->filter) { -- 2.34.1