event->type = LTTNG_EVENT_TRACEPOINT; /* Hack */
ret = event_kernel_enable_event(kchan, event,
filter_expression, filter);
+ /* We have passed ownership */
+ filter_expression = NULL;
+ filter = NULL;
if (ret != LTTNG_OK) {
if (channel_created) {
/* Let's not leak a useless channel. */
case LTTNG_EVENT_TRACEPOINT:
ret = event_kernel_enable_event(kchan, event,
filter_expression, filter);
+ /* We have passed ownership */
+ filter_expression = NULL;
+ filter = NULL;
if (ret != LTTNG_OK) {
if (channel_created) {
/* Let's not leak a useless channel. */
case LTTNG_EVENT_SYSCALL:
ret = event_kernel_enable_event(kchan, event,
filter_expression, filter);
+ /* We have passed ownership */
+ filter_expression = NULL;
+ filter = NULL;
if (ret != LTTNG_OK) {
goto error;
}
if (kevent == NULL) {
ret = kernel_create_event(event, kchan,
filter_expression, filter);
+ /* We have passed ownership */
+ filter_expression = NULL;
+ filter = NULL;
if (ret < 0) {
switch (-ret) {
case EEXIST:
ret = LTTNG_OK;
end:
+ free(filter_expression);
+ free(filter);
return ret;
}
/*
* Allocate and initialize a kernel event. Set name and event type.
+ * We own filter_expression, and filter.
*
* Return pointer to structure or NULL.
*/
return lke;
error:
+ free(filter_expression);
+ free(filter);
free(lke);
free(attr);
return NULL;