diff --git a/src/haproxy.c b/src/haproxy.c index d5c7121d9..1730545ef 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -2805,16 +2805,9 @@ void deinit(void) free_proxy(p0); }/* end while(p) */ - /* we don't need to free sink_proxies_list proxies since it is - * already handled in sink_deinit() + /* we don't need to free sink_proxies_list nor cfg_log_forward proxies since + * they are respectively cleaned up in sink_deinit() and deinit_log_forward() */ - p = cfg_log_forward; - /* we need to manually clean cfg_log_forward proxy list */ - while (p) { - p0 = p; - p = p->next; - free_proxy(p0); - } /* destroy all referenced defaults proxies */ proxy_destroy_all_unref_defaults(); diff --git a/src/log.c b/src/log.c index 7c626a965..e8430a88b 100644 --- a/src/log.c +++ b/src/log.c @@ -1958,6 +1958,20 @@ void deinit_log_buffers() logline_rfc5424 = NULL; } +/* Deinitialize log forwarder proxies used for syslog messages */ +void deinit_log_forward() +{ + struct proxy *p, *p0; + + p = cfg_log_forward; + /* we need to manually clean cfg_log_forward proxy list */ + while (p) { + p0 = p; + p = p->next; + free_proxy(p0); + } +} + /* Builds a log line in based on , and stops before reaching * characters. Returns the size of the output string in characters, * not counting the trailing zero which is always added if the resulting size @@ -3973,6 +3987,8 @@ REGISTER_CONFIG_SECTION("log-forward", cfg_parse_log_forward, NULL); REGISTER_PER_THREAD_ALLOC(init_log_buffers); REGISTER_PER_THREAD_FREE(deinit_log_buffers); +REGISTER_POST_DEINIT(deinit_log_forward); + /* * Local variables: * c-indent-level: 8