[epiphany] profile-migrator: Fix leaks in migrate-bookmarks



commit 11bb293341687e8167cdfe8c89464f00bf7efdfc
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sun Oct 9 18:05:14 2016 -0500

    profile-migrator: Fix leaks in migrate-bookmarks
    
    Also, g_clear_object is overkill here

 src/profile-migrator/ephy-profile-migrator.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/profile-migrator/ephy-profile-migrator.c b/src/profile-migrator/ephy-profile-migrator.c
index 69a467d..b87f965 100644
--- a/src/profile-migrator/ephy-profile-migrator.c
+++ b/src/profile-migrator/ephy-profile-migrator.c
@@ -564,7 +564,7 @@ migrate_bookmarks (void)
 {
   EphyBookmarksManager *manager = EPHY_BOOKMARKS_MANAGER (g_object_new (EPHY_TYPE_BOOKMARKS_MANAGER, NULL));
 
-  const char *filename;
+  char *filename;
   xmlDocPtr doc;
   xmlNodePtr child;
   xmlNodePtr root;
@@ -574,12 +574,12 @@ migrate_bookmarks (void)
                                NULL);
 
   if (g_file_test (filename, G_FILE_TEST_EXISTS) == FALSE)
-    return;
+    goto out;
 
   doc = xmlParseFile (filename);
   if (doc == NULL) {
     g_warning ("Failed to re-import the bookmarks. All bookmarks lost!\n");
-    return;
+    goto out;
   }
 
   root = xmlDocGetRootElement (doc);
@@ -599,7 +599,9 @@ migrate_bookmarks (void)
                                              NULL);
 
   xmlFreeDoc (doc);
-  g_clear_object (&manager);
+out:
+  g_free (filename):
+  g_object_unref (manager);
 }
 
 static void


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