diff options
author | James Booth <boothj5@gmail.com> | 2015-08-09 01:24:15 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-08-09 01:24:15 +0100 |
commit | dea10ecfdc01756203f30975914a1d594070aa18 (patch) | |
tree | 415a69507d2fc9e8c0df908c0ad9dbc4c0fe12eb /src | |
parent | d501576fcf767057ed5528e270ad97b35d689bb6 (diff) | |
download | profani-tty-dea10ecfdc01756203f30975914a1d594070aa18.tar.gz |
Dereference timestamp on chat logging
Diffstat (limited to 'src')
-rw-r--r-- | src/log.c | 7 |
1 files changed, 6 insertions, 1 deletions
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 |