From 82aa621b47018838c9659d34ab34cd6517815daa Mon Sep 17 00:00:00 2001 From: Roger Dingledine <arma@torproject.org> Date: Sat, 18 Oct 2003 00:07:58 +0000 Subject: [PATCH] rewrite close_logs so it could possibly work remove deadbeef memory-clobber testing (for now) svn:r616 --- src/common/log.c | 14 +++++++------- src/common/util.c | 2 +- 2 files changed, 8 insertions(+), 8 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() diff --git a/src/common/util.c b/src/common/util.c index 5f7a6017de..333cd65e6e 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -21,7 +21,7 @@ void *tor_malloc(size_t size) { log_fn(LOG_ERR, "Out of memory. Dying."); exit(1); } - memset(result,'X',size); /* XXX deadbeef to encourage bugs */ +// memset(result,'X',size); /* deadbeef to encourage bugs */ return result; } -- GitLab