[devhelp/gnome-2-28] Fix leak in search_combo_row_separator_func()



commit 9100fb2666a73fc913d478f284125d693afc28cf
Author: Jonathon Jongsma <jonathon quotidian org>
Date:   Tue Sep 29 15:21:15 2009 -0500

    Fix leak in search_combo_row_separator_func()
    
    This patch should fix the following leak by freeing the values returned from
    gtk_tree_model_get()
    
    ==17510== 2,879 bytes in 137 blocks are definitely lost in loss record 9,522 of 9,665
    ==17510==    at 0x4C221A7: malloc (vg_replace_malloc.c:195)
    ==17510==    by 0x7BAC232: g_malloc (gmem.c:131)
    ==17510==    by 0x7BC3CFD: g_strdup (gstrfuncs.c:102)
    ==17510==    by 0xFA3EADC: value_lcopy_string (gvaluetypes.c:313)
    ==17510==    by 0xB73A49F: gtk_tree_model_get_valist (gtktreemodel.c:1443)
    ==17510==    by 0xB73A6E8: gtk_tree_model_get (gtktreemodel.c:1405)
    ==17510==    by 0x5042643: search_combo_row_separator_func (dh-search.c:482)
    ==17510==    by 0xB5D8C51: gtk_combo_box_menu_fill_level (gtkcombobox.c:2944)
    ==17510==    by 0xB5D8FAB: gtk_combo_box_relayout (gtkcombobox.c:3139)
    ==17510==    by 0xB5DC3EF: gtk_combo_box_set_row_separator_func (gtkcombobox.c:5807)
    ==17510==    by 0x5042E0C: dh_search_new (dh-search.c:542)
    ==17510==    by 0x5047980: dh_window_new (dh-window.c:843)
    ==17510==    by 0x504067D: dh_base_new_window (dh-base.c:441)
    ==17510==    by 0x4020E7: main (dh-main.c:286)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=596808
    (cherry picked from commit 0c585729739615b2092f9afb430eadff17560ee6)

 src/dh-search.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/dh-search.c b/src/dh-search.c
index b580e43..c921143 100644
--- a/src/dh-search.c
+++ b/src/dh-search.c
@@ -478,10 +478,15 @@ search_combo_row_separator_func (GtkTreeModel *model,
 {
         char *label;
         char *link;
+        gboolean result;
 
         gtk_tree_model_get (model, iter, 0, &label, 1, &link, -1);
 
-        return (link == NULL && label == NULL);
+        result = (link == NULL && label == NULL);
+        g_free (label);
+        g_free (link);
+
+        return result;
 }
 
 static GtkWidget *



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]