projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: sessiond: leak of trace chunk on destruction error
[lttng-tools.git]
/
src
/
bin
/
lttng-relayd
/
viewer-stream.c
diff --git
a/src/bin/lttng-relayd/viewer-stream.c
b/src/bin/lttng-relayd/viewer-stream.c
index 21294d1f32dfc700c33c1075b1343e36b84c2833..25ee35e5cadb97787a23e238dccfbcdae0924820 100644
(file)
--- a/
src/bin/lttng-relayd/viewer-stream.c
+++ b/
src/bin/lttng-relayd/viewer-stream.c
@@
-27,6
+27,7
@@
static void viewer_stream_destroy(struct relay_viewer_stream *vstream)
{
static void viewer_stream_destroy(struct relay_viewer_stream *vstream)
{
+ lttng_trace_chunk_put(vstream->stream_file.trace_chunk);
free(vstream->path_name);
free(vstream->channel_name);
free(vstream);
free(vstream->path_name);
free(vstream->channel_name);
free(vstream);
@@
-41,11
+42,12
@@
static void viewer_stream_destroy_rcu(struct rcu_head *head)
}
struct relay_viewer_stream *viewer_stream_create(struct relay_stream *stream,
}
struct relay_viewer_stream *viewer_stream_create(struct relay_stream *stream,
+ struct lttng_trace_chunk *viewer_trace_chunk,
enum lttng_viewer_seek seek_t)
{
struct relay_viewer_stream *vstream = NULL;
const bool acquired_reference = lttng_trace_chunk_get(
enum lttng_viewer_seek seek_t)
{
struct relay_viewer_stream *vstream = NULL;
const bool acquired_reference = lttng_trace_chunk_get(
-
stream->
trace_chunk);
+
viewer_
trace_chunk);
if (!acquired_reference) {
goto error;
if (!acquired_reference) {
goto error;
@@
-57,7
+59,8
@@
struct relay_viewer_stream *viewer_stream_create(struct relay_stream *stream,
goto error;
}
goto error;
}
- vstream->stream_file.trace_chunk = stream->trace_chunk;
+ vstream->stream_file.trace_chunk = viewer_trace_chunk;
+ viewer_trace_chunk = NULL;
vstream->path_name = lttng_strndup(stream->path_name, LTTNG_VIEWER_PATH_MAX);
if (vstream->path_name == NULL) {
PERROR("relay viewer path_name alloc");
vstream->path_name = lttng_strndup(stream->path_name, LTTNG_VIEWER_PATH_MAX);
if (vstream->path_name == NULL) {
PERROR("relay viewer path_name alloc");
@@
-129,7
+132,8
@@
struct relay_viewer_stream *viewer_stream_create(struct relay_stream *stream,
const uint32_t connection_minor = stream->trace->session->minor;
vstream->index_file = lttng_index_file_create_from_trace_chunk_read_only(
const uint32_t connection_minor = stream->trace->session->minor;
vstream->index_file = lttng_index_file_create_from_trace_chunk_read_only(
- stream->trace_chunk, stream->path_name,
+ vstream->stream_file.trace_chunk,
+ stream->path_name,
stream->channel_name, stream->tracefile_size,
vstream->current_tracefile_id,
lttng_to_index_major(connection_major,
stream->channel_name, stream->tracefile_size,
vstream->current_tracefile_id,
lttng_to_index_major(connection_major,
@@
-169,6
+173,9
@@
error:
if (vstream) {
viewer_stream_destroy(vstream);
}
if (vstream) {
viewer_stream_destroy(vstream);
}
+ if (viewer_trace_chunk) {
+ lttng_trace_chunk_put(viewer_trace_chunk);
+ }
return NULL;
}
return NULL;
}
@@
-205,7
+212,7
@@
static void viewer_stream_release(struct urcu_ref *ref)
stream_put(vstream->stream);
vstream->stream = NULL;
}
stream_put(vstream->stream);
vstream->stream = NULL;
}
- lttng_trace_chunk_put(vstream->stream_file.trace_chunk);
+
call_rcu(&vstream->rcu_node, viewer_stream_destroy_rcu);
}
call_rcu(&vstream->rcu_node, viewer_stream_destroy_rcu);
}
@@
-312,7
+319,8
@@
int viewer_stream_rotate(struct relay_viewer_stream *vstream)
}
vstream->index_file =
lttng_index_file_create_from_trace_chunk_read_only(
}
vstream->index_file =
lttng_index_file_create_from_trace_chunk_read_only(
- stream->trace_chunk, stream->path_name,
+ vstream->stream_file.trace_chunk,
+ stream->path_name,
stream->channel_name,
stream->tracefile_size,
vstream->current_tracefile_id,
stream->channel_name,
stream->tracefile_size,
vstream->current_tracefile_id,
This page took
0.024744 seconds
and
4
git commands to generate.