From 10186df707e08f25896ab69d5dc2d9fe7de1c860 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 16 Jun 2014 18:12:58 +0200 Subject: Fix memory leaks when generating message list It turned out that the values returned from ml_tree_value_at_ex() can be dynamically allocated, thus proper free functions should be called for these too. --- mail/message-list.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/mail/message-list.c b/mail/message-list.c index 7852e67179..995dac57d4 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -5144,8 +5144,16 @@ free_message_info_data (gpointer uid, struct sort_array_data *sort_data) { if (data->values) { - /* values in this array are not newly allocated, even ml_tree_value_at_ex - * returns gpointer, not a gconstpointer */ + gint ii; + + for (ii = 0; ii < sort_data->sort_columns->len && ii < data->values->len; ii++) { + struct sort_column_data *scol = g_ptr_array_index (sort_data->sort_columns, ii); + + message_list_free_value ((ETreeModel *) sort_data->message_list, + scol->col->spec->compare_col, + g_ptr_array_index (data->values, ii)); + } + g_ptr_array_free (data->values, TRUE); } -- cgit v1.2.3