projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: Memory leak in relay_add_stream error path
[lttng-tools.git]
/
src
/
bin
/
lttng-relayd
/
ctf-trace.c
diff --git
a/src/bin/lttng-relayd/ctf-trace.c
b/src/bin/lttng-relayd/ctf-trace.c
index 6fe77a5b4438f5833e9eaa9bfeb3c092aaacf964..ab1610929aa5da6e0424749ee9c28eb968356fc7 100644
(file)
--- a/
src/bin/lttng-relayd/ctf-trace.c
+++ b/
src/bin/lttng-relayd/ctf-trace.c
@@
-38,6
+38,14
@@
static void rcu_destroy_ctf_trace(struct rcu_head *head)
free(trace);
}
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.
*
/*
* 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);
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);
}
call_rcu(&obj->node.head, rcu_destroy_ctf_trace);
@@
-75,6
+83,7
@@
void ctf_trace_try_destroy(struct relay_session *session,
*/
if (uatomic_read(&session->viewer_refcount) == 0 &&
uatomic_read(&ctf_trace->refcount) == 0) {
*/
if (uatomic_read(&session->viewer_refcount) == 0 &&
uatomic_read(&ctf_trace->refcount) == 0) {
+ ctf_trace_delete(session->ctf_traces_ht, ctf_trace);
ctf_trace_destroy(ctf_trace);
}
}
ctf_trace_destroy(ctf_trace);
}
}
This page took
0.026204 seconds
and
4
git commands to generate.