mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-26 21:40:08 +01:00
device: refactor dispose/cleanup of NMDevice to free members in finalize
NMTestDevice does not invoke dispose(), hence it leaks memory which causes
false warnings in testing.
Some minor refactring to let dispose() clear the fields, but free it
later in finalize(). This avoids memleaks in the NMTestDevice stub.
(cherry picked from commit a82d94a64e)
This commit is contained in:
parent
2eb71b6229
commit
a369923d03
1 changed files with 5 additions and 3 deletions
|
|
@ -8356,7 +8356,7 @@ dispose (GObject *object)
|
|||
|
||||
_cleanup_generic_post (self, FALSE);
|
||||
|
||||
g_clear_pointer (&priv->ip6_saved_properties, g_hash_table_unref);
|
||||
g_hash_table_remove_all (priv->ip6_saved_properties);
|
||||
|
||||
if (priv->recheck_assume_id) {
|
||||
g_source_remove (priv->recheck_assume_id);
|
||||
|
|
@ -8372,8 +8372,7 @@ dispose (GObject *object)
|
|||
priv->con_provider = NULL;
|
||||
}
|
||||
|
||||
g_hash_table_unref (priv->available_connections);
|
||||
priv->available_connections = NULL;
|
||||
g_hash_table_remove_all (priv->available_connections);
|
||||
|
||||
if (priv->carrier_wait_id) {
|
||||
g_source_remove (priv->carrier_wait_id);
|
||||
|
|
@ -8410,6 +8409,9 @@ finalize (GObject *object)
|
|||
g_free (priv->type_desc);
|
||||
g_free (priv->dhcp_anycast_address);
|
||||
|
||||
g_hash_table_unref (priv->ip6_saved_properties);
|
||||
g_hash_table_unref (priv->available_connections);
|
||||
|
||||
G_OBJECT_CLASS (nm_device_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue