Blob Blame History Raw
From 36c5e90469b36cb0724f45447ae923a6d6ccf348 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mat=C4=9Bj=20Grabovsk=C3=BD?= <mgrabovs@redhat.com>
Date: Fri, 25 Oct 2019 12:37:44 +0200
Subject: [PATCH] gtk: Fix another possible double-free

The object should only be freed if we're in the cleanup phase, i.e. only
in the if-branch of the condition.

This one was introduced in dc281652.
---
 src/gui-wizard-gtk/wizard.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index 4b840bac..ec8bb68b 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -2518,7 +2518,7 @@ static bool highligh_words_in_textview(int page, GtkTextView *tev, GList *words,
     while (valid)
     {
         g_autofree char *text = NULL;
-        g_autofree search_item_t *word = NULL;
+        search_item_t *word = NULL;
 
         gtk_tree_model_get(GTK_TREE_MODEL(g_ls_sensitive_list), &iter,
                 SEARCH_COLUMN_TEXT, &text,
@@ -2533,6 +2533,8 @@ static bool highligh_words_in_textview(int page, GtkTextView *tev, GList *words,
 
             if (word == g_current_highlighted_word)
                 g_current_highlighted_word = NULL;
+
+            free(word);
         }
         else
         {
-- 
2.23.0