diff options
Diffstat (limited to 'src/common/log.c')
-rw-r--r-- | src/common/log.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/common/log.c b/src/common/log.c index faa8f64891..3a60d0576d 100644 --- a/src/common/log.c +++ b/src/common/log.c @@ -116,14 +116,14 @@ void _log_fn(int severity, const char *fn, const char *format, ...) void close_logs() { - logfile_t *next, *lf; - for (lf = logfiles; lf; lf = lf->next) { - if (lf->needs_close) - fclose(lf->file); - next = lf->next; - free(lf); + logfile_t *victim; + while(logfiles) { + victim = logfiles; + logfiles = logfiles->next; + if (victim->needs_close) + fclose(victim->file); + free(victim); } - logfiles = NULL; } void reset_logs() |