Skip to content
Snippets Groups Projects
Commit 8bfa84f7 authored by Beat Küng's avatar Beat Küng
Browse files

log_writer_file: make sure to close the file

and avoid doing a loop iteration when the thread is requested to exit
(as it could access _buffer).
parent 50740ef8
No related branches found
No related tags found
No related merge requests found
......@@ -70,6 +70,10 @@ LogWriterFile::~LogWriterFile()
perf_free(_perf_write);
perf_free(_perf_fsync);
if (_fd >= 0) {
::close(_fd);
}
if (_buffer) {
delete[] _buffer;
}
......@@ -91,6 +95,8 @@ void LogWriterFile::start_log(const char *filename)
if (_buffer == nullptr) {
PX4_ERR("Can't create log buffer");
::close(_fd);
_fd = -1;
_should_run = false;
return;
}
......@@ -174,6 +180,10 @@ void LogWriterFile::run()
}
}
if (_exit_thread) {
break;
}
int poll_count = 0;
int written = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment