Do not access uninitialized file object

If the opening of the logfile fails it must not be assumed
to have been opened when cleaning up.
This commit is contained in:
Johan Wikman
2016-09-06 10:14:22 +03:00
parent 4e3de4c56d
commit ca6c619d60

View File

@ -2052,9 +2052,6 @@ static void filewriter_done(filewriter_t* fw)
{ {
case RUN: case RUN:
CHK_FILEWRITER(fw); CHK_FILEWRITER(fw);
case INIT:
fw->fwr_logmes = NULL;
fw->fwr_clientmes = NULL;
if (log_config.use_stdout) if (log_config.use_stdout)
{ {
skygw_file_free(fw->fwr_file); skygw_file_free(fw->fwr_file);
@ -2063,7 +2060,11 @@ static void filewriter_done(filewriter_t* fw)
{ {
skygw_file_close(fw->fwr_file, true); skygw_file_close(fw->fwr_file, true);
} }
case INIT:
fw->fwr_logmes = NULL;
fw->fwr_clientmes = NULL;
fw->fwr_state = DONE; fw->fwr_state = DONE;
break;
case DONE: case DONE:
case UNINIT: case UNINIT:
default: default: