fix when accessing uninitialized file

master
Andre Puschmann 7 years ago
parent 8fcf25360e
commit 20e6ed102e

@ -35,6 +35,7 @@ namespace srslte{
logger_file::logger_file() logger_file::logger_file()
:inited(false) :inited(false)
,logfile(NULL)
,not_done(true) ,not_done(true)
,cur_length(0) ,cur_length(0)
,max_length(0) ,max_length(0)
@ -46,9 +47,11 @@ logger_file::~logger_file() {
if(inited) { if(inited) {
wait_thread_finish(); wait_thread_finish();
flush(); flush();
if (logfile) {
fclose(logfile); fclose(logfile);
} }
} }
}
void logger_file::init(std::string file, int max_length_) { void logger_file::init(std::string file, int max_length_) {
pthread_mutex_init(&mutex, NULL); pthread_mutex_init(&mutex, NULL);

Loading…
Cancel
Save