mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-11 04:50:33 +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.
This commit is contained in:
parent
ae73320b8c
commit
a82d94a64e
1 changed files with 5 additions and 3 deletions
|
|
@ -8323,7 +8323,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);
|
||||
|
|
@ -8339,8 +8339,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);
|
||||
|
|
@ -8377,6 +8376,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