Fix: Memory leak in relay_add_stream error path
[lttng-tools.git] / src / bin / lttng-relayd / ctf-trace.c
index 59946ea4a8810bde2edc67414d782f34fc4032cb..aed9eb4da68a1fe702c8b8546ad0b06f3f190f84 100644 (file)
@@ -39,6 +39,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.
  *
@@ -58,7 +66,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.023581 seconds and 4 git commands to generate.