X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Flttng-ctl.c;h=b9dc1efb095de163ff3d4ca50bfba28ed6596378;hp=a385d1b9a0a540f589d843b11a78325975cc4aa9;hb=dcd5daf2e2acb0745d5e6ff66185147007e8ed53;hpb=3f0c88379cfbbbec84641e13b21f290a563f8729 diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index a385d1b9a..b9dc1efb0 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -74,6 +74,7 @@ static int connected; */ int lttng_opt_quiet; int lttng_opt_verbose; +int lttng_opt_mi; /* * Copy string from src to dst and enforce null terminated byte. @@ -824,6 +825,12 @@ static int generate_filter(char *filter_expression, ret = -LTTNG_ERR_FILTER_INVAL; goto parse_error; } + /* Validate strings used as literals in the expression */ + ret = filter_visitor_ir_validate_string(ctx); + if (ret) { + ret = -LTTNG_ERR_FILTER_INVAL; + goto parse_error; + } dbg_printf("done\n"); dbg_printf("Generating bytecode... "); @@ -973,7 +980,7 @@ int lttng_enable_event_with_exclusions(struct lttng_handle *handle, + LTTNG_SYMBOL_NAME_LEN * exclusion_count); if (!varlen_data) { ret = -LTTNG_ERR_EXCLUSION_NOMEM; - goto filter_error; + goto mem_error; } /* Put exclusion names first in the data */ @@ -1002,19 +1009,19 @@ int lttng_enable_event_with_exclusions(struct lttng_handle *handle, lsm.u.enable.bytecode_len + lsm.u.enable.expression_len, NULL); free(varlen_data); -filter_error: - if (filter_expression) { +mem_error: + if (filter_expression && ctx) { filter_bytecode_free(ctx); filter_ir_free(ctx); filter_parser_ctx_free(ctx); - if (free_filter_expression) { - /* - * The filter expression has been replaced and must be - * freed as it is not the original filter expression - * received as a parameter. - */ - free(filter_expression); - } + } +filter_error: + if (free_filter_expression) { + /* + * The filter expression has been replaced and must be freed as it is + * not the original filter expression received as a parameter. + */ + free(filter_expression); } error: /*