}
if (!opt_filter) {
- char *exclusion_string;
-
command_ret = lttng_enable_event_with_exclusions(
handle,
ev,
nullptr,
lttng_dynamic_pointer_array_get_count(&exclusions),
(char **) exclusions.array.buffer.data);
- exclusion_string = print_exclusions(&exclusions);
+
+ auto exclusion_string = lttng::make_unique_wrapper<char, lttng::free>(
+ print_exclusions(&exclusions));
if (!exclusion_string) {
PERROR("Cannot allocate exclusion_string");
error = 1;
(std::string("with pattern `") +
pattern + std::string("`"))
.c_str(),
- exclusion_string,
+ exclusion_string.get(),
print_channel_name(channel_name),
session_name.c_str());
warn = 1;
(std::string("with pattern `") +
pattern + std::string("`"))
.c_str(),
- exclusion_string,
+ exclusion_string.get(),
command_ret == -LTTNG_ERR_NEED_CHANNEL_NAME ?
print_raw_channel_name(channel_name) :
print_channel_name(channel_name),
lttng_strerror(command_ret),
session_name.c_str());
+
+ if (opt_kernel) {
+ print_kernel_tracer_status_error();
+ }
+
error = 1;
break;
}
(std::string("with pattern `") +
pattern + std::string("`"))
.c_str(),
- exclusion_string,
+ exclusion_string.get(),
print_channel_name(channel_name));
break;
}
(std::string("with pattern `") +
pattern + std::string("`"))
.c_str(),
- exclusion_string);
+ exclusion_string.get());
break;
default:
abort();
}
}
-
- free(exclusion_string);
} else {
- char *exclusion_string;
-
/* Filter present */
ev->filter = 1;
opt_filter,
lttng_dynamic_pointer_array_get_count(&exclusions),
(char **) exclusions.array.buffer.data);
- exclusion_string = print_exclusions(&exclusions);
+
+ auto exclusion_string = lttng::make_unique_wrapper<char, lttng::free>(
+ print_exclusions(&exclusions));
if (!exclusion_string) {
PERROR("Failed allocate exclusion string");
error = 1;
(std::string("with pattern `") +
pattern + std::string("`"))
.c_str(),
- exclusion_string,
+ exclusion_string.get(),
opt_filter,
print_channel_name(channel_name));
warn = 1;
(std::string("with pattern `") +
pattern + std::string("`"))
.c_str(),
- exclusion_string,
+ exclusion_string.get(),
opt_filter,
command_ret == -LTTNG_ERR_NEED_CHANNEL_NAME ?
print_raw_channel_name(channel_name) :
lttng_strerror(command_ret),
session_name.c_str());
error = 1;
+
+ if (opt_kernel) {
+ print_kernel_tracer_status_error();
+ }
+
break;
}
std::string("`"))
.c_str(),
- exclusion_string,
+ exclusion_string.get(),
opt_filter);
}
-
- free(exclusion_string);
}
if (lttng_opt_mi) {