[epiphany/mcatanzaro/#1101: 10/10] password-manager: free records in async data free funcs



commit 7678b0518f433caea229fe96fedb82c3efd18a61
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Tue Feb 18 13:27:27 2020 -0600

    password-manager: free records in async data free funcs
    
    This makes more sense than doing it manually in a bunch of different
    places. It fixes a leak when ephy_password_manager_query() is called by
    EphyWebView. It also fixes leak of deleted_records/updated_records.

 lib/sync/ephy-password-manager.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
---
diff --git a/lib/sync/ephy-password-manager.c b/lib/sync/ephy-password-manager.c
index 47767f5c8..fb809475e 100644
--- a/lib/sync/ephy-password-manager.c
+++ b/lib/sync/ephy-password-manager.c
@@ -109,6 +109,7 @@ query_async_data_free (QueryAsyncData *data)
 {
   g_assert (data);
 
+  g_list_free_full (data->records, g_object_unref);
   g_free (data);
 }
 
@@ -162,6 +163,8 @@ merge_passwords_async_data_free (MergePasswordsAsyncData *data)
   g_assert (data);
 
   g_object_unref (data->manager);
+  g_list_free_full (data->remotes_deleted, g_object_unref);
+  g_list_free_full (data->remotes_updated, g_object_unref);
   g_free (data);
 }
 
@@ -306,8 +309,6 @@ populate_cache_cb (GList    *records,
 
     ephy_password_manager_cache_add (self, origin, username);
   }
-
-  g_list_free_full (records, g_object_unref);
 }
 
 static void
@@ -480,7 +481,6 @@ update_password_cb (GList    *records,
     ephy_password_record_set_password (record, data->password);
     ephy_password_manager_store_record (data->manager, record);
     g_signal_emit_by_name (data->manager, "synchronizable-modified", record, FALSE);
-    g_list_free_full (records, g_object_unref);
   } else {
     LOG ("Attempted to update password record that doesn't exist (likely Epiphany bug)");
   }
@@ -754,8 +754,6 @@ forget_cb (GList    *records,
   } else {
     g_warn_if_reached ();
   }
-
-  g_list_free_full (records, g_object_unref);
 }
 
 void
@@ -790,7 +788,6 @@ forget_all_cb (GList    *records,
   ephy_password_manager_cache_clear (self);
 
   g_hash_table_unref (attributes);
-  g_list_free_full (records, g_object_unref);
 }
 
 void
@@ -875,7 +872,6 @@ replace_existing_cb (GList    *records,
   else
     g_warn_if_reached ();
 
-  g_list_free_full (records, g_object_unref);
   manage_record_async_data_free (data);
 }
 
@@ -1157,7 +1153,6 @@ merge_cb (GList    *records,
 
   data->callback (to_upload, data->user_data);
 
-  g_list_free_full (records, g_object_unref);
   merge_passwords_async_data_free (data);
 }
 


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