From dfc32d784366dd861e759e18e023535a45f69598 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sun, 29 May 2022 16:59:50 +0200 Subject: [PATCH] Fix memory leak on exit Only to clean up, possibly relevant for no-MMU systems, but they have other issues as well (e.g. fork) that prevent them from using the sysklogd project. Signed-off-by: Joachim Wiberg --- src/syslogd.c | 5 +++++ src/timer.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/syslogd.c b/src/syslogd.c index cdab802..33b73a3 100644 --- a/src/syslogd.c +++ b/src/syslogd.c @@ -2372,6 +2372,11 @@ void die(int signo) flog(LOG_SYSLOG | LOG_INFO, "exiting on signal %d", signo); } + /* + * Stop all active timers + */ + timer_exit(); + /* * Close all open log files. */ diff --git a/src/timer.c b/src/timer.c index 2fd7280..025b650 100644 --- a/src/timer.c +++ b/src/timer.c @@ -212,7 +212,7 @@ void timer_exit(void) alarm(0); - close(timer_fd[0]); + socket_close((timer_fd[0])); close(timer_fd[1]); LIST_FOREACH_SAFE(tmr, &tmr_head, tmr_link, tmp) {