From dea10ecfdc01756203f30975914a1d594070aa18 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 9 Aug 2015 01:24:15 +0100 Subject: [PATCH] Dereference timestamp on chat logging --- src/log.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/log.c b/src/log.c index e4c7f305..e4e6e809 100644 --- a/src/log.c +++ b/src/log.c @@ -380,7 +380,11 @@ _chat_log_chat(const char * const login, const char * const other, g_hash_table_replace(logs, strdup(other), dated_log); } - if (timestamp == NULL) timestamp = g_date_time_new_now_local(); + if (timestamp == NULL) { + timestamp = g_date_time_new_now_local(); + } else { + g_date_time_ref(timestamp); + } gchar *date_fmt = g_date_time_format(timestamp, "%H:%M:%S"); FILE *logp = fopen(dated_log->filename, "a"); @@ -407,6 +411,7 @@ _chat_log_chat(const char * const login, const char * const other, } g_free(date_fmt); + g_date_time_unref(timestamp); } void