/*
* Command LTTNG_ENABLE_EVENT processed by the client thread.
+ * We own filter, exclusion, and filter_expression.
*/
int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain,
char *channel_name, struct lttng_event *event,
/* At this point, the session and channel exist on the tracer */
ret = event_ust_enable_tracepoint(usess, uchan, event,
filter_expression, filter, exclusion);
+ /* We have passed ownership */
+ filter_expression = NULL;
+ filter = NULL;
+ exclusion = NULL;
if (ret != LTTNG_OK) {
goto error;
}
ret = cmd_enable_event(session, &tmp_dom, (char *) default_chan_name,
&uevent, filter_expression, filter, NULL, wpipe);
+ /* We have passed ownership */
+ filter_expression = NULL;
+ filter = NULL;
if (ret != LTTNG_OK && ret != LTTNG_ERR_UST_EVENT_ENABLED) {
goto error;
}
ret = LTTNG_OK;
error:
+ free(filter_expression);
+ free(filter);
+ free(exclusion);
rcu_read_unlock();
return ret;
}
/*
* Enable kernel tracepoint event for a channel from the kernel session.
+ * We own filter_expression and filter.
*/
int event_kernel_enable_tracepoint(struct ltt_kernel_channel *kchan,
struct lttng_event *event)
/*
* Enable UST tracepoint event for a channel from a UST session.
+ * We own filter_expression, filter, and exclusion.
*/
int event_ust_enable_tracepoint(struct ltt_ust_session *usess,
struct ltt_ust_channel *uchan, struct lttng_event *event,
if (uevent == NULL) {
uevent = trace_ust_create_event(event, filter_expression,
filter, exclusion);
+ /* We have passed ownership */
+ filter_expression = NULL;
+ filter = NULL;
+ exclusion = NULL;
if (uevent == NULL) {
ret = LTTNG_ERR_UST_ENABLE_FAIL;
goto error;
end:
rcu_read_unlock();
+ free(filter_expression);
+ free(filter);
+ free(exclusion);
return ret;
error:
trace_ust_destroy_event(uevent);
}
rcu_read_unlock();
+ free(filter_expression);
+ free(filter);
+ free(exclusion);
return ret;
}
/*
* Create a kernel event, enable it to the kernel tracer and add it to the
* channel event list of the kernel session.
+ * We own filter_expression and filter.
*/
int kernel_create_event(struct lttng_event *ev,
struct ltt_kernel_channel *channel)
if (bytecode_len > LTTNG_FILTER_MAX_LEN) {
ret = LTTNG_ERR_FILTER_INVAL;
+ free(filter_expression);
free(exclusion);
goto error;
}
bytecode = zmalloc(bytecode_len);
if (!bytecode) {
+ free(filter_expression);
free(exclusion);
ret = LTTNG_ERR_FILTER_NOMEM;
goto error;
if (ret <= 0) {
DBG("Nothing recv() from client car len data... continuing");
*sock_error = 1;
+ free(filter_expression);
free(bytecode);
free(exclusion);
ret = LTTNG_ERR_FILTER_INVAL;
}
if ((bytecode->len + sizeof(*bytecode)) != bytecode_len) {
+ free(filter_expression);
free(bytecode);
free(exclusion);
ret = LTTNG_ERR_FILTER_INVAL;
/*
* Allocate and initialize a ust event. Set name and event type.
+ * We own filter_expression, filter, and exclusion.
*
* Return pointer to structure or NULL.
*/
error_free_event:
free(lue);
error:
+ free(filter_expression);
+ free(filter);
+ free(exclusion);
return NULL;
}