summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Kang <jonathankang@gnome.org>2018-03-19 15:35:56 +0800
committerJonathan Kang <jonathankang@gnome.org>2018-03-21 17:47:54 +0800
commit93fcf1af6fe28a4501d273f562068dddedca575e (patch)
tree2c21c137d2c26f6445fceabd9f8bfde4292a799e
parent5363d3297e9e0efde3da439410c8b48af8adc7d3 (diff)
downloadgnome-logs-wip/jonathankang/fix-mem-leak.tar.gz
free GlQuery when journal model is disposingwip/jonathankang/fix-mem-leak
GlJournalModel contains GlQuery in its private structure. And GlQuery should be free using gl_query_free() to avoid memory leak.
-rw-r--r--src/gl-journal-model.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gl-journal-model.c b/src/gl-journal-model.c
index 4bb2030..ea68cea 100644
--- a/src/gl-journal-model.c
+++ b/src/gl-journal-model.c
@@ -67,6 +67,7 @@ static gboolean gl_query_check_journal_end (GlQuery *query, GlJournalEntry *entr
static gboolean gl_row_entry_check_message_similarity (GlRowEntry *current_row_entry,
GlRowEntry *prev_row_entry);
static void gl_journal_model_add_header (GlJournalModel *model);
+static void gl_query_free (GlQuery *query);
G_DEFINE_TYPE (GlRowEntry, gl_row_entry, G_TYPE_OBJECT);
@@ -269,6 +270,11 @@ gl_journal_model_dispose (GObject *object)
gl_journal_model_stop_idle (model);
+ if (model->query)
+ {
+ gl_query_free (model->query);
+ }
+
if (model->entries)
{
g_ptr_array_free (model->entries, TRUE);