[gnome-notes/fix-manager-leak] manager: Fix memory leak




commit cb80085e84a05921fda3e1e58e174f2f5ad5b0aa
Author: Isaque Galdino <igaldino gmail com>
Date:   Sun Apr 18 20:42:50 2021 -0300

    manager: Fix memory leak
    
    This commit fixes memory leak introduced by commit
    75bea8d6ea091d0964823392a7294c643cf6177a where it tries to release
    local_provider object memory twice.
    
    The 1st one is done correct in g_hash_table_unref where local_provider
    was added by _add_provider method. The 2nd and wrong one is just after
    that, by g_clear_object in manager_finalize method.

 src/libbiji/biji-manager.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
---
diff --git a/src/libbiji/biji-manager.c b/src/libbiji/biji-manager.c
index 4d1d466..9ad7919 100644
--- a/src/libbiji/biji-manager.c
+++ b/src/libbiji/biji-manager.c
@@ -166,7 +166,7 @@ load_goa_provider (BijiManager *self,
   for (l = accounts; l != NULL; l = l->next)
   {
     object = GOA_OBJECT (l->data);
-    account =  goa_object_peek_account (object);
+    account = goa_object_peek_account (object);
 
     if (GOA_IS_ACCOUNT (account))
     {
@@ -273,13 +273,10 @@ biji_manager_finalize (GObject *object)
 {
   BijiManager *self = BIJI_MANAGER (object);
 
-
   g_clear_object (&self->location);
   g_hash_table_destroy (self->items);
   g_hash_table_destroy (self->archives);
-
   g_hash_table_unref (self->providers);
-  g_clear_object (&self->local_provider);
 
   G_OBJECT_CLASS (biji_manager_parent_class)->finalize (object);
 }


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