Fix: Memory leak in relay_add_stream error path
[lttng-tools.git] / src / bin / lttng-relayd / ctf-trace.c
index 9e9a5c69eb87a1f802fd0fc75bd5ea0f2a7a0151..ab1610929aa5da6e0424749ee9c28eb968356fc7 100644 (file)
@@ -38,6 +38,14 @@ static void rcu_destroy_ctf_trace(struct rcu_head *head)
        free(trace);
 }
 
+static void rcu_destroy_stream(struct rcu_head *head)
+{
+       struct relay_stream *stream =
+               caa_container_of(head, struct relay_stream, rcu_node);
+
+       stream_destroy(stream);
+}
+
 /*
  * Destroy a ctf trace and all stream contained in it.
  *
@@ -57,7 +65,7 @@ void ctf_trace_destroy(struct ctf_trace *obj)
        cds_list_for_each_entry_safe(stream, tmp_stream, &obj->stream_list,
                        trace_list) {
                stream_delete(relay_streams_ht, stream);
-               stream_destroy(stream);
+               call_rcu(&stream->rcu_node, rcu_destroy_stream);
        }
 
        call_rcu(&obj->node.head, rcu_destroy_ctf_trace);
This page took 0.023834 seconds and 4 git commands to generate.