From 47f4de20ef098f875a05f739f5f2775450eda2b2 Mon Sep 17 00:00:00 2001
From: schneider <schneider@blinkenlichts.net>
Date: Tue, 13 Oct 2020 22:51:10 +0200
Subject: [PATCH] fix(config): Clear config before reloading

Closes #211
---
 epicardium/modules/config.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/epicardium/modules/config.c b/epicardium/modules/config.c
index 2e741b93f..4928a84aa 100644
--- a/epicardium/modules/config.c
+++ b/epicardium/modules/config.c
@@ -246,6 +246,19 @@ void load_config(void)
 		return;
 	}
 
+	/* Clear any existing configuration */
+	config_block *current;
+	if (config_data != NULL) {
+		current = config_data;
+		while (true) {
+			memset(current->slots, 0, sizeof(current->slots));
+			if (current->next == NULL) {
+				break;
+			}
+			current = current->next;
+		}
+	}
+
 	char buf[128];
 	int nread;
 	parser_state s;
-- 
GitLab