X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fcmd.c;h=2dcc52b7a2aff880bdfbb1c9fc61cb8ece35c27d;hp=8c13c2dd6aa24414c6a6ee61c3999afe11f68933;hb=971da06a61170301dc28c2203ef0679c3024e21d;hpb=49d21f93659c296425c129bc7722bd8255f5c1b1 diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 8c13c2dd6..2dcc52b7a 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -1604,11 +1604,30 @@ int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain, assert(0); } - 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; + { + struct lttng_filter_bytecode *filter_copy = NULL; + + if (filter) { + filter_copy = zmalloc( + sizeof(struct lttng_filter_bytecode) + + filter->len); + if (!filter_copy) { + goto error; + } + + memcpy(filter_copy, filter, + sizeof(struct lttng_filter_bytecode) + + filter->len); + } + + ret = cmd_enable_event(session, &tmp_dom, + (char *) default_chan_name, + &uevent, filter_expression, filter_copy, + NULL, wpipe); + /* We have passed ownership */ + filter_expression = NULL; + } + if (ret != LTTNG_OK && ret != LTTNG_ERR_UST_EVENT_ENABLED) { goto error; } @@ -1616,8 +1635,10 @@ int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain, /* The wild card * means that everything should be enabled. */ if (strncmp(event->name, "*", 1) == 0 && strlen(event->name) == 1) { ret = event_agent_enable_all(usess, agt, event, filter); + filter = NULL; } else { ret = event_agent_enable(usess, agt, event, filter); + filter = NULL; } if (ret != LTTNG_OK) { goto error;