From f7c4cea5671b25f21a3b84b80d61d69f2dd26353 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Tue, 10 Mar 2009 07:11:17 +0000 Subject: [PATCH] logsys_format_set should use its own internal copy of format_buffer git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1796 fd59a12c-fef9-0310-b244-a6a79926bd2f --- exec/logsys.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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); }