From: Olivier Houchard Date: Thu, 7 Mar 2019 13:19:24 +0000 (+0100) Subject: BUG/MEDIUM: logs: Only attempt to free startup_logs once. X-Git-Tag: v2.0-dev2~108 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7c49711d6041d1afc42d5b310ddfd7d6f6817c3c;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: logs: Only attempt to free startup_logs once. deinit_log_buffers() can be called once per thread, however startup_logs is common to all threads. So only attempt to free it once. This should be backported to 1.9 and 1.8. --- diff --git a/src/log.c b/src/log.c index a4cedcc5af..826f50e45e 100644 --- a/src/log.c +++ b/src/log.c @@ -1692,11 +1692,15 @@ int init_log_buffers() /* Deinitialize log buffers used for syslog messages */ void deinit_log_buffers() { + void *tmp_startup_logs; + free(logheader); free(logheader_rfc5424); free(logline); free(logline_rfc5424); - free(startup_logs); + tmp_startup_logs = HA_ATOMIC_XCHG(&startup_logs, NULL); + free(tmp_startup_logs); + logheader = NULL; logheader_rfc5424 = NULL; logline = NULL;