[epiphany/gnome-3-24] Fix leaks of GtkContainer children list



commit e4e7de5b06c98b796f4b9abbfeb004cbe25c25fd
Author: Gabriel Ivascu <gabrielivascu gnome org>
Date:   Thu Aug 24 11:57:40 2017 +0300

    Fix leaks of GtkContainer children list

 lib/widgets/ephy-location-entry.c      |    2 ++
 src/bookmarks/ephy-bookmarks-popover.c |   11 +++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index 72b7e12..0b8dfc1 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -662,6 +662,7 @@ entry_populate_popup_cb (GtkEntry          *entry,
     if (GTK_IS_SEPARATOR_MENU_ITEM (item->data))
       sep++;
   }
+  g_list_free (children);
 
   gtk_menu_shell_insert (GTK_MENU_SHELL (menu), clear_menuitem, pos - 1);
 
@@ -676,6 +677,7 @@ entry_populate_popup_cb (GtkEntry          *entry,
     }
   }
   g_assert (paste_menuitem != NULL);
+  g_list_free (children);
 
   g_signal_connect (paste_and_go_menuitem, "activate",
                     G_CALLBACK (entry_paste_and_go_activate_cb), lentry);
diff --git a/src/bookmarks/ephy-bookmarks-popover.c b/src/bookmarks/ephy-bookmarks-popover.c
index 1e43e86..a1258a2 100644
--- a/src/bookmarks/ephy-bookmarks-popover.c
+++ b/src/bookmarks/ephy-bookmarks-popover.c
@@ -79,6 +79,7 @@ remove_bookmark_row_from_container (GtkContainer *container,
       break;
     }
   }
+  g_list_free (children);
 }
 
 static void
@@ -151,6 +152,7 @@ ephy_bookmarks_popover_bookmark_tag_removed_cb (EphyBookmarksPopover *self,
         }
       }
     }
+    g_list_free (children);
 
     if (!exists) {
       row = create_bookmark_row (bookmark, self);
@@ -185,6 +187,7 @@ ephy_bookmarks_popover_bookmark_tag_removed_cb (EphyBookmarksPopover *self,
         if (g_strcmp0 (title, tag) == 0)
           gtk_container_remove (GTK_CONTAINER (self->tags_list_box), GTK_WIDGET (l->data));
       }
+      g_list_free (children);
   }
 }
 
@@ -367,17 +370,17 @@ ephy_bookmarks_popover_actions_tag_detail_back (GSimpleAction *action,
                                                 gpointer       user_data)
 {
   EphyBookmarksPopover *self = user_data;
-  GList *l;
+  GList *children;
 
   g_assert (EPHY_IS_BOOKMARKS_POPOVER (self));
 
   gtk_stack_set_visible_child_name (GTK_STACK (self->toplevel_stack),
                                     "default");
 
-  for (l = gtk_container_get_children (GTK_CONTAINER (self->tag_detail_list_box));
-       l != NULL;
-       l = l->next)
+  children = gtk_container_get_children (GTK_CONTAINER (self->tag_detail_list_box));
+  for (GList *l = children; l != NULL; l = l->next)
     gtk_container_remove (GTK_CONTAINER (self->tag_detail_list_box), l->data);
+  g_list_free (children);
 }
 
 static void


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