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 <jeremie.galarneau@efficios.com>
ret = LTTNG_ERR_NOMEM;
goto error;
}
-
+ filter = NULL;
+ filter_expression = NULL;
created = 1;
}
/* Already enabled? */
if (aevent->enabled) {
+ ret = LTTNG_OK;
goto end;
}
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;
}