From: Jonathan Rajotte Date: Wed, 10 Apr 2019 20:11:30 +0000 (-0400) Subject: Fix: out_fd can be uninitialized. X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=commitdiff_plain;h=05f1df32a7453452765b0a46fb723047815ba2ef Fix: out_fd can be uninitialized. If out_fd is uninitialized return success. This happens for snapshot stream for example. Signed-off-by: Jonathan Rajotte --- diff --git a/src/common/consumer/consumer.c b/src/common/consumer/consumer.c index d46fc30a9..5a87e1896 100644 --- a/src/common/consumer/consumer.c +++ b/src/common/consumer/consumer.c @@ -3886,6 +3886,11 @@ int consumer_clear_stream_files(struct lttng_consumer_stream *stream) return LTTCOMM_CONSUMERD_SUCCESS; } + /* Stream might not have out_fd set. Snapshot stream for example. */ + if (stream->out_fd < 0) { + return LTTCOMM_CONSUMERD_SUCCESS; + } + ret = close(stream->out_fd); if (ret < 0) { PERROR("Closing tracefile");