Fix: sessiond: ODR violation results in memory corruption
[lttng-tools.git] / src / common / actions / rate-policy.cpp
index 58db624d8312814bff23b1fec56e78ee4d5c698a..c9c7a05197c2cbea1d8f8be4c8d30c8f2f07b1a1 100644 (file)
@@ -48,6 +48,7 @@ struct lttng_rate_policy {
        rate_policy_mi_serialize_cb mi_serialize;
 };
 
+namespace {
 struct lttng_rate_policy_every_n {
        struct lttng_rate_policy parent;
        uint64_t interval;
@@ -70,6 +71,7 @@ struct lttng_rate_policy_once_after_n_comm {
 struct lttng_rate_policy_every_n_comm {
        uint64_t interval;
 } LTTNG_PACKED;
+} /* namespace */
 
 /* Forward declaration. */
 static void lttng_rate_policy_init(struct lttng_rate_policy *rate_policy,
@@ -487,7 +489,7 @@ struct lttng_rate_policy *lttng_rate_policy_every_n_create(uint64_t interval)
                goto end;
        }
 
-       policy = (lttng_rate_policy_every_n *) zmalloc(sizeof(struct lttng_rate_policy_every_n));
+       policy = zmalloc<lttng_rate_policy_every_n>();
        if (!policy) {
                goto end;
        }
@@ -702,7 +704,7 @@ struct lttng_rate_policy *lttng_rate_policy_once_after_n_create(
                goto end;
        }
 
-       policy = (lttng_rate_policy_once_after_n *) zmalloc(sizeof(struct lttng_rate_policy_once_after_n));
+       policy = zmalloc<lttng_rate_policy_once_after_n>();
        if (!policy) {
                goto end;
        }
This page took 0.023829 seconds and 4 git commands to generate.