Fix: "Cleanup: clarify bytecode ownership"
[deliverable/lttng-ust.git] / liblttng-ust / lttng-events.c
index 664f8b5d05c6f82a1bb55e1a085ee6c9b4e6479f..acf5f3b6c0744f44d7d5a2a2d50b1bf519c67d66 100644 (file)
@@ -1526,12 +1526,14 @@ int lttng_event_notifier_enabler_attach_filter_bytecode(
 
 int lttng_event_notifier_enabler_attach_capture_bytecode(
                struct lttng_event_notifier_enabler *event_notifier_enabler,
-               struct lttng_ust_bytecode_node *bytecode)
+               struct lttng_ust_bytecode_node **bytecode)
 {
-       bytecode->enabler = lttng_event_notifier_enabler_as_enabler(
+       (*bytecode)->enabler = lttng_event_notifier_enabler_as_enabler(
                        event_notifier_enabler);
-       cds_list_add_tail(&bytecode->node,
+       cds_list_add_tail(&(*bytecode)->node,
                        &event_notifier_enabler->capture_bytecode_head);
+       /* Take ownership of bytecode */
+       *bytecode = NULL;
        event_notifier_enabler->num_captures++;
 
        lttng_event_notifier_group_sync_enablers(event_notifier_enabler->group);
This page took 0.024398 seconds and 5 git commands to generate.