From b618b972b6e9b5157e8662438fbdd9036654453b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Wed, 14 Nov 2018 12:29:06 +0100 Subject: [PATCH] conversation: Use automatic cleanup --- src/chatty-conversation.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/chatty-conversation.c b/src/chatty-conversation.c index 6663f63d..a9697728 100644 --- a/src/chatty-conversation.c +++ b/src/chatty-conversation.c @@ -559,10 +559,6 @@ chatty_add_message_history_to_conv (gpointer data) gchar *name = NULL; const gchar *conv_name; const gchar *b_name; - gchar *read_log; - gchar *stripped; - gchar **line_split = NULL; - gchar **logs = NULL; gchar *time_stamp; gchar *msg_html; GList *history; @@ -583,8 +579,10 @@ chatty_add_message_history_to_conv (gpointer data) // limit the log-list to MAX_MSGS msgs since we currently have no // infinite scrolling implemented for (int i = 0; history && i < MAX_MSGS; history = history->next) { - read_log = purple_log_read ((PurpleLog*)history->data, NULL); - stripped = purple_markup_strip_html (read_log); + g_auto(GStrv) line_split = NULL; + g_auto(GStrv) logs = NULL; + g_autofree gchar *read_log = purple_log_read ((PurpleLog*)history->data, NULL); + g_autofree gchar *stripped = purple_markup_strip_html (read_log); logs = g_strsplit (stripped, "\n", -1); @@ -599,11 +597,6 @@ chatty_add_message_history_to_conv (gpointer data) line_split = g_strsplit (b_name, "/", -1); name = g_strdup (line_split[0]); - - g_free (read_log); - g_free (stripped); - g_strfreev (logs); - g_strfreev (line_split); } g_list_foreach (history, (GFunc)purple_log_free, NULL); -- GitLab