blob: 484af7e2ef96067388dee5bea96e51549637150e [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001From 86842df8bff5c97e44fc55d2fb7fc6c10f56ab84 Mon Sep 17 00:00:00 2001
2From: Gergely Nagy <algernon@balabit.hu>
3Date: Fri, 13 Dec 2013 13:46:15 +0100
4Subject: [PATCH] mainloop: Deinit the new config when reverting to the old one
5
6Upstream-Status: Backport
7
8When reloading, and the new config fails, deinit it before initializing
9the old config. This is so that conflicting things do not remain held by
10the half-initialized new config, while the old tries to take it
11over. (It also removed a couple of memory leaks, most likely.)
12
13The reason we can do this, is because cfg_tree_stop() (called by
14cfg_deinit()) goes over all the known nodes, and log_pipe_deinit() is
15also smart enough to not deinit a node that has not been inited before.
16
17Signed-off-by: Gergely Nagy <algernon@balabit.hu>
18---
19 lib/mainloop.c | 1 +
20 1 file changed, 1 insertion(+)
21
22diff --git a/lib/mainloop.c b/lib/mainloop.c
23index 34655fa..e6fbb59 100644
24--- a/lib/mainloop.c
25+++ b/lib/mainloop.c
26@@ -510,6 +510,7 @@ main_loop_reload_config_apply(void)
27 {
28 msg_error("Error initializing new configuration, reverting to old config", NULL);
29 cfg_persist_config_move(main_loop_new_config, main_loop_old_config);
30+ cfg_deinit(main_loop_new_config);
31 if (!cfg_init(main_loop_old_config))
32 {
33 /* hmm. hmmm, error reinitializing old configuration, we're hosed.
34--
351.8.4.1
36