Fix: sessiond ust-app session teardown race
[lttng-tools.git] / src / bin / lttng-sessiond / trace-ust.c
index a804fb6b890570e924b0cb54187437598febbbe7..5f41bd764308a812806f623bdfb2ed24c09b838d 100644 (file)
@@ -365,6 +365,7 @@ error:
 
 /*
  * Allocate and initialize a ust event. Set name and event type.
+ * We own filter_expression, filter, and exclusion.
  *
  * Return pointer to structure or NULL.
  */
@@ -445,6 +446,9 @@ struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev,
 error_free_event:
        free(lue);
 error:
+       free(filter_expression);
+       free(filter);
+       free(exclusion);
        return NULL;
 }
 
@@ -470,7 +474,12 @@ int trace_ust_context_type_event_to_ust(enum lttng_event_context_type type)
                utype = LTTNG_UST_CONTEXT_IP;
                break;
        case LTTNG_EVENT_CONTEXT_PERF_THREAD_COUNTER:
-               utype = LTTNG_UST_CONTEXT_PERF_THREAD_COUNTER;
+               if (!ustctl_has_perf_counters()) {
+                       utype = -1;
+                       WARN("Perf counters not implemented in UST");
+               } else {
+                       utype = LTTNG_UST_CONTEXT_PERF_THREAD_COUNTER;
+               }
                break;
        default:
                ERR("Invalid UST context");
This page took 0.024413 seconds and 4 git commands to generate.