[devhelp] BookTree: plug a memory leak, always free GtkTreePath in select_uri()



commit f35f26aedbf2bb0729948097748497c686a1849d
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat Dec 9 18:30:47 2017 +0100

    BookTree: plug a memory leak, always free GtkTreePath in select_uri()
    
    Found with Valgrind.

 src/dh-book-tree.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/dh-book-tree.c b/src/dh-book-tree.c
index d0c2c83..e97fe28 100644
--- a/src/dh-book-tree.c
+++ b/src/dh-book-tree.c
@@ -874,16 +874,15 @@ dh_book_tree_select_uri (DhBookTree  *tree,
                                 (GtkTreeModelForeachFunc) book_tree_find_uri_foreach,
                                 &data);
 
-        if (!data.found) {
+        if (!data.found)
                 return;
-        }
 
         selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
 
         /* Do not re-select (which will expand current additionally) if already
          * there. */
         if (gtk_tree_selection_iter_is_selected (selection, &data.iter))
-                return;
+                goto out;
 
         /* FIXME: it's strange to block the signal here. The signal handler
          * should probably be blocked in DhWindow instead.
@@ -908,6 +907,7 @@ dh_book_tree_select_uri (DhBookTree  *tree,
                                            book_tree_selection_changed_cb,
                                            tree);
 
+out:
         gtk_tree_path_free (data.path);
 }
 


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