Fix: lttng-crash: fd leak
[lttng-tools.git] / src / bin / lttng-relayd / stream.c
index af4ef1bbb80d9e17fe331298c4fac558d0795d3c..a314eb9f984155561bf64b91ffd920c902fa0379 100644 (file)
@@ -137,6 +137,11 @@ struct relay_stream *stream_create(struct ctf_trace *trace,
                ret = -1;
                goto end;
        }
+       stream->tfa = tracefile_array_create(stream->tracefile_count);
+       if (!stream->tfa) {
+               ret = -1;
+               goto end;
+       }
        if (stream->tracefile_size) {
                DBG("Tracefile %s/%s_0 created", stream->path_name, stream->channel_name);
        } else {
@@ -241,6 +246,9 @@ static void stream_destroy(struct relay_stream *stream)
        if (stream->indexes_ht) {
                lttng_ht_destroy(stream->indexes_ht);
        }
+       if (stream->tfa) {
+               tracefile_array_destroy(stream->tfa);
+       }
        free(stream->path_name);
        free(stream->channel_name);
        free(stream);
@@ -332,6 +340,7 @@ void stream_close(struct relay_stream *stream)
 {
        DBG("closing stream %" PRIu64, stream->stream_handle);
        pthread_mutex_lock(&stream->lock);
+       stream->closed = true;
        relay_index_close_all(stream);
        pthread_mutex_unlock(&stream->lock);
        stream_put(stream);
This page took 0.023032 seconds and 4 git commands to generate.