Message ID | CAF2baFde4LrR1N7O_tfs-6tXrVOFf1fR3mi-H3gJHtynJ+eZJw@mail.gmail.com |
---|---|
State | New |
Delegated to: | Jérémie Galarneau |
Headers | show |
diff --git a/src/common/index/index.c b/src/common/index/index.c index b481badb..008d877b 100644 --- a/src/common/index/index.c +++ b/src/common/index/index.c @@ -129,11 +129,19 @@ int lttng_index_file_write(const struct lttng_index_file *index_file, const struct ctf_packet_index *element) { ssize_t ret; - int fd = index_file->fd; - size_t len = index_file->element_len; + int fd; + size_t len; assert(element); + if (index_file == NULL) { + PERROR("index file is NULL"); + goto error; + } + + fd = index_file->fd; + len = index_file->element_len; + if (fd < 0) { goto error;