Fix: liblttng-ust-fork Makefile flags mismatch
[lttng-ust.git] / liblttng-ust / lttng-filter.c
index 4714dad2ad50c1d7d09e0cc3450ee7366c06bbc7..11e7e376a03006bec8fb2af8b86f95f16d53874a 100644 (file)
@@ -254,7 +254,7 @@ int _lttng_filter_event_link_bytecode(struct lttng_event *event,
        runtime = zmalloc(runtime_alloc_len);
        if (!runtime) {
                ret = -ENOMEM;
-               goto link_error;
+               goto alloc_error;
        }
        runtime->p.bc = filter_bytecode;
        runtime->len = filter_bytecode->bc.reloc_offset;
@@ -289,13 +289,16 @@ int _lttng_filter_event_link_bytecode(struct lttng_event *event,
                goto link_error;
        }
        runtime->p.filter = lttng_filter_interpret_bytecode;
+       runtime->p.link_failed = 0;
        cds_list_add_rcu(&runtime->p.node, insert_loc);
        dbg_printf("Linking successful.\n");
        return 0;
 
 link_error:
        runtime->p.filter = lttng_filter_false;
+       runtime->p.link_failed = 1;
        cds_list_add_rcu(&runtime->p.node, insert_loc);
+alloc_error:
        dbg_printf("Linking failed.\n");
        return ret;
 }
@@ -304,10 +307,10 @@ void lttng_filter_sync_state(struct lttng_bytecode_runtime *runtime)
 {
        struct lttng_ust_filter_bytecode_node *bc = runtime->bc;
 
-       if (bc->enabler->enabled)
-               runtime->filter = lttng_filter_interpret_bytecode;
-       else
+       if (!bc->enabler->enabled || runtime->link_failed)
                runtime->filter = lttng_filter_false;
+       else
+               runtime->filter = lttng_filter_interpret_bytecode;
 }
 
 /*
This page took 0.025472 seconds and 4 git commands to generate.