Fix: "Cleanup: clarify bytecode ownership"
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 25 Feb 2021 17:36:18 +0000 (12:36 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 25 Feb 2021 17:36:34 +0000 (12:36 -0500)
The function lttng_event_notifier_enabler_attach_capture_bytecode
have also been adapted to this change.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I6d8a984af829356329f933b552f9ada34387fd2c

liblttng-ust/lttng-events.c
liblttng-ust/lttng-ust-abi.c
liblttng-ust/ust-events-internal.h

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);
index 8c0c46553d6c8ff4277f924b0eba5eff8a6d6474..4703dc3dbff73d296b3a871db57bcc990777b931 100644 (file)
@@ -719,7 +719,7 @@ long lttng_event_notifier_enabler_cmd(int objd, unsigned int cmd, unsigned long
        case LTTNG_UST_CAPTURE:
                return lttng_event_notifier_enabler_attach_capture_bytecode(
                        event_notifier_enabler,
-                       (struct lttng_ust_bytecode_node *) arg);
+                       (struct lttng_ust_bytecode_node **) arg);
        case LTTNG_UST_ENABLE:
                return lttng_event_notifier_enabler_enable(event_notifier_enabler);
        case LTTNG_UST_DISABLE:
index 1d8e914ad2487dc9d56a8c0b1bdd62aa1928e90d..fc55cb03b64e3fb275bf7fe6e27a01c2020298f5 100644 (file)
@@ -233,7 +233,7 @@ int lttng_event_notifier_enabler_attach_filter_bytecode(
 LTTNG_HIDDEN
 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);
 
 /*
  * Attach exclusion list to `struct lttng_event_notifier_enabler` and all
This page took 0.027862 seconds and 4 git commands to generate.