diff --git a/exec/logsys.c b/exec/logsys.c index bf1c7669..6be80a23 100644 --- a/exec/logsys.c +++ b/exec/logsys.c @@ -873,10 +873,16 @@ void logsys_format_set (char *format) { pthread_mutex_lock (&logsys_config_mutex); - if (format) - format_buffer = format; - else - format_buffer = "[%6s] %b"; + if (format_buffer) { + free(format_buffer); + format_buffer = NULL; + } + + if (format) { + format_buffer = strdup(format); + } else { + format_buffer = strdup("[%6s] %b"); + } pthread_mutex_unlock (&logsys_config_mutex); }