From: Jérémie Galarneau Date: Wed, 25 Sep 2019 21:06:23 +0000 (-0400) Subject: sessiond: clean-up: silence warning that agent event is leaked X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=commitdiff_plain;h=6fe2a7d00ab34f9a4db653c04819cd465fefa196 sessiond: clean-up: silence warning that agent event is leaked 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 --- 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) {