From: Jérémie Galarneau Date: Sat, 12 Jan 2019 19:53:56 +0000 (-0500) Subject: Fix: leak of filter bytecode and expression on agent event re-enable X-Git-Tag: v2.12.0-rc1~669 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=b0a23296344e57bd2e48e62ec2d7e0d8a38661bb;p=lttng-tools.git Fix: leak of filter bytecode and expression on agent event re-enable The agent subsystem does not properly assume the clean-up of an event's filter bytecode and expression when a previously disabled event is re-enabled. This change ensures that the ownership of both the filter bytecode and expression is assumed by the agent subsystem and discarded when a matching event is found. Steps to reproduce the leak: $ lttng create $ lttng enable-event --python allo --filter 'a[42] == 241' $ lttng disable-event --python allo $ lttng enable-event --python allo --filter 'a[42] == 241' Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/event.c b/src/bin/lttng-sessiond/event.c index f97148db1..b0b37bed7 100644 --- a/src/bin/lttng-sessiond/event.c +++ b/src/bin/lttng-sessiond/event.c @@ -506,7 +506,8 @@ int event_agent_enable(struct ltt_ust_session *usess, ret = LTTNG_ERR_NOMEM; goto error; } - + filter = NULL; + filter_expression = NULL; created = 1; } @@ -533,13 +534,16 @@ int event_agent_enable(struct ltt_ust_session *usess, agent_add_event(aevent, agt); } -end: - return LTTNG_OK; + ret = LTTNG_OK; + goto end; error: if (created) { agent_destroy_event(aevent); } +end: + free(filter); + free(filter_expression); return ret; }