[epiphany/mcatanzaro/#1098] pages-[view, popover]: fix leak in items_changed_cb()



commit d041cc2c12645b7c73a7b196dc00995b3ea75f0c
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Mon Feb 17 13:13:53 2020 -0600

    pages-[view,popover]: fix leak in items_changed_cb()
    
    Ownership of the items themselves is transferred to self->list_store,
    but we have to free the array.
    
    Fixes #1098

 src/ephy-pages-popover.c | 2 +-
 src/ephy-pages-view.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/ephy-pages-popover.c b/src/ephy-pages-popover.c
index 8a4dc52ea..a39538f50 100644
--- a/src/ephy-pages-popover.c
+++ b/src/ephy-pages-popover.c
@@ -130,7 +130,7 @@ items_changed_cb (EphyPagesPopover *self,
                   gint              added,
                   GMenuModel       *menu_model)
 {
-  EphyPageRow **items = g_new (EphyPageRow *, added);
+  g_autofree EphyPageRow **items = g_new (EphyPageRow *, added);
 
   if ((guint)(position + removed) > g_list_model_get_n_items (G_LIST_MODEL (self->list_store)))
     return;
diff --git a/src/ephy-pages-view.c b/src/ephy-pages-view.c
index 19e759946..1a02eac89 100644
--- a/src/ephy-pages-view.c
+++ b/src/ephy-pages-view.c
@@ -118,7 +118,7 @@ items_changed_cb (EphyPagesView *self,
                   gint           added,
                   GMenuModel    *menu_model)
 {
-  EphyPageRow **items = g_new (EphyPageRow *, added);
+  g_autofree EphyPageRow **items = g_new (EphyPageRow *, added);
 
   for (int i = 0; i < added; i++) {
     items[i] = ephy_page_row_new (self->notebook, position + i);


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