From 0599cdf4bbc8a38d159cff27195c71e27fb21000 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 25 Nov 2015 15:18:47 +0000 Subject: [PATCH] Clean log buffer when forking --- src/libutil/logger.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/libutil/logger.c b/src/libutil/logger.c index 5f5d062d3..2c7ceeef7 100644 --- a/src/libutil/logger.c +++ b/src/libutil/logger.c @@ -386,6 +386,21 @@ rspamd_log_update_pid (GQuark ptype, rspamd_logger_t *rspamd_log) { rspamd_log->pid = getpid (); rspamd_log->process_type = ptype; + + /* We also need to clear all messages pending */ + if (rspamd_log->repeats > 0) { + rspamd_log->repeats = 0; + if (rspamd_log->saved_message) { + g_free (rspamd_log->saved_message); + g_free (rspamd_log->saved_function); + g_free (rspamd_log->saved_module); + g_free (rspamd_log->saved_id); + rspamd_log->saved_message = NULL; + rspamd_log->saved_function = NULL; + rspamd_log->saved_module = NULL; + rspamd_log->saved_id = NULL; + } + } } /** -- 2.39.5