Fix: sessiond: ODR violation results in memory corruption
[lttng-tools.git] / src / bin / lttng-relayd / sessiond-trace-chunks.cpp
index 0a5c44825414bc720fe6081e459b5b3410c349b4..34f14f187fbe5d615cc0fd849a9fb3855722bced 100644 (file)
@@ -56,6 +56,7 @@ struct sessiond_trace_chunk_registry {
        struct cds_lfht *ht;
 };
 
+namespace {
 struct trace_chunk_registry_ht_key {
        lttng_uuid sessiond_uuid;
 };
@@ -70,6 +71,7 @@ struct trace_chunk_registry_ht_element {
        struct lttng_trace_chunk_registry *trace_chunk_registry;
        struct sessiond_trace_chunk_registry *sessiond_trace_chunk_registry;
 };
+} /* namespace */
 
 static
 unsigned long trace_chunk_registry_ht_key_hash(
@@ -197,7 +199,7 @@ int trace_chunk_registry_ht_element_create(
                goto end;
        }
 
-       new_element = (trace_chunk_registry_ht_element *) zmalloc(sizeof(*new_element));
+       new_element = zmalloc<trace_chunk_registry_ht_element>();
        if (!new_element) {
                ret = -1;
                goto end;
@@ -263,7 +265,7 @@ end:
 struct sessiond_trace_chunk_registry *sessiond_trace_chunk_registry_create(void)
 {
        struct sessiond_trace_chunk_registry *sessiond_registry =
-                       (sessiond_trace_chunk_registry *) zmalloc(sizeof(*sessiond_registry));
+                       zmalloc<sessiond_trace_chunk_registry>();
 
        if (!sessiond_registry) {
                goto end;
This page took 0.022994 seconds and 4 git commands to generate.