[grisbi-devel] [PATCH 2/5] Fix leaked strings from g_utf8_casefold() in gtk_combofix_select_item()

RĂ©mi Cardona remi at gentoo.org
Tue Apr 9 07:56:00 CEST 2013


---
 src/gtk_combofix.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/gtk_combofix.c b/src/gtk_combofix.c
index e3cb602..4306535 100644
--- a/src/gtk_combofix.c
+++ b/src/gtk_combofix.c
@@ -1797,16 +1797,23 @@ static gboolean gtk_combofix_select_item ( GtkComboFix *combofix,
 
         gtk_tree_model_get ( model, &iter, COMBOFIX_COL_REAL_STRING, &tmp_str, -1 );
 
-        if ( tmp_str
-         &&
-         tmp_item
-         &&
-         g_utf8_collate ( g_utf8_casefold ( tmp_str, -1 ),
-         g_utf8_casefold ( tmp_item, -1 ) ) == 0 )
-            break;
+        if ( tmp_str && tmp_item )
+        {
+            gchar *tmp_str_casefold, *tmp_item_casefold;
+            int collate;
+
+            tmp_str_casefold = g_utf8_casefold ( tmp_str, -1 );
+            tmp_item_casefold = g_utf8_casefold ( tmp_item, -1 );
+            collate = g_utf8_collate ( tmp_str_casefold , tmp_item_casefold );
+            g_free ( tmp_item_casefold );
+            g_free ( tmp_str_casefold );
+
+            if ( collate  == 0 )
+                break;
+        }
 
         result = gtk_tree_model_iter_next ( model, &iter);
-	}
+    }
 
     g_free ( tmp_item );
 
-- 
1.8.1.4



More information about the devel mailing list