>From 0b6a043c1f084bad3716b63044cdaff0008a20a1 Mon Sep 17 00:00:00 2001
From: Mikael Magnusson <mikma@users.sourceforge.net>
Date: Mon, 31 Aug 2020 22:43:29 +0200
Subject: [PATCH] Log: Fix assert in add_tail caused by default_log_list

Clean up old log_list in default_log_list if it has been
initialized already. A log_config node may be reused which
otherwise causes an assertion (if built with --enable-debug).
---
 sysdep/unix/log.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sysdep/unix/log.c b/sysdep/unix/log.c
index e24322c6..13cab04f 100644
--- a/sysdep/unix/log.c
+++ b/sysdep/unix/log.c
@@ -335,6 +335,13 @@ static list *
 default_log_list(int initial, const char **syslog_name)
 {
   static list log_list;
+  struct log_config *lc, *lc_next;
+
+  /* Clean up old log_list. */
+  if (log_list.head)
+    WALK_LIST_DELSAFE(lc, lc_next, log_list)
+      rem_node(&lc->n);
+
   init_list(&log_list);
   *syslog_name = NULL;
 
-- 
2.25.1

