[epiphany/wip/bookmarks: 56/76] bookmarks: Fix some memory leaks



commit d1605e003ac078929ca43db58378ace25511861b
Author: Iulian Radu <iulian radu67 gmail com>
Date:   Tue Sep 27 17:33:17 2016 +0300

    bookmarks: Fix some memory leaks

 src/ephy-add-bookmark-popover.c |   12 ++++++++++++
 src/ephy-bookmark.c             |    1 +
 src/ephy-bookmarks-manager.c    |    2 +-
 3 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/src/ephy-add-bookmark-popover.c b/src/ephy-add-bookmark-popover.c
index 258b968..c01b644 100644
--- a/src/ephy-add-bookmark-popover.c
+++ b/src/ephy-add-bookmark-popover.c
@@ -63,6 +63,17 @@ ephy_bookmarks_popover_set_property (GObject      *object,
 }
 
 static void
+ephy_add_bookmark_popover_finalize (GObject *object)
+{
+  EphyAddBookmarkPopover *self = EPHY_ADD_BOOKMARK_POPOVER (object);
+
+  if (self->address)
+    g_free (self->address);
+
+  G_OBJECT_CLASS (ephy_add_bookmark_popover_parent_class)->finalize (object);
+}
+
+static void
 ephy_add_bookmark_popover_constructed (GObject *object)
 {
   EphyAddBookmarkPopover *self = EPHY_ADD_BOOKMARK_POPOVER (object);
@@ -82,6 +93,7 @@ ephy_add_bookmark_popover_class_init (EphyAddBookmarkPopoverClass *klass)
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
   object_class->set_property = ephy_bookmarks_popover_set_property;
+  object_class->finalize = ephy_add_bookmark_popover_finalize;
   object_class->constructed = ephy_add_bookmark_popover_constructed;
 
   obj_properties[PROP_HEADER_BAR] =
diff --git a/src/ephy-bookmark.c b/src/ephy-bookmark.c
index 09a6ded..43596c9 100644
--- a/src/ephy-bookmark.c
+++ b/src/ephy-bookmark.c
@@ -229,6 +229,7 @@ ephy_bookmark_set_title (EphyBookmark *self, const char *title)
 {
   g_return_if_fail (EPHY_IS_BOOKMARK (self));
 
+  g_free (self->title);
   self->title = g_strdup (title);
   g_object_notify_by_pspec (G_OBJECT (self), obj_properties[PROP_TITLE]);
 }
diff --git a/src/ephy-bookmarks-manager.c b/src/ephy-bookmarks-manager.c
index f6fa98b..6415440 100644
--- a/src/ephy-bookmarks-manager.c
+++ b/src/ephy-bookmarks-manager.c
@@ -546,7 +546,7 @@ ephy_bookmarks_manager_load_from_file (EphyBookmarksManager *self)
     GVariantIter *iter;
     GSequence *tags;
     char *tag;
-    char *title;
+    const char *title;
     gint64 time_added;
 
     /* Obtain the correspoding GVariant. */


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