From 4141e69b3a368f5b450fbc99a37557f77ef2fd08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= Date: Tue, 11 Feb 2014 13:58:17 +0100 Subject: [PATCH] settings: free memory in finalize(), not in dispose() in NMSecretAgent (rh #1061911) Even if the code changed in master compared to the bug report, the issues would still occur when we freed members in dispose. https://bugzilla.redhat.com/show_bug.cgi?id=1061911 --- src/settings/nm-secret-agent.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/settings/nm-secret-agent.c b/src/settings/nm-secret-agent.c index 22391cf94f..bf0bba1297 100644 --- a/src/settings/nm-secret-agent.c +++ b/src/settings/nm-secret-agent.c @@ -514,24 +514,27 @@ dispose (GObject *object) { NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (object); - g_clear_pointer (&priv->description, g_free); - g_clear_pointer (&priv->identifier, g_free); - g_clear_pointer (&priv->owner_username, g_free); - - g_slist_free_full (priv->permissions, g_free); - priv->permissions = NULL; - - if (priv->requests) { - g_hash_table_destroy (priv->requests); - priv->requests = NULL; - } - proxy_cleanup (NM_SECRET_AGENT (object)); g_clear_object (&priv->subject); G_OBJECT_CLASS (nm_secret_agent_parent_class)->dispose (object); } +static void +finalize (GObject *object) +{ + NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (object); + + g_free (priv->description); + g_free (priv->identifier); + g_free (priv->owner_username); + + g_slist_free_full (priv->permissions, g_free); + g_hash_table_destroy (priv->requests); + + G_OBJECT_CLASS (nm_secret_agent_parent_class)->finalize (object); +} + static void nm_secret_agent_class_init (NMSecretAgentClass *config_class) { @@ -541,5 +544,6 @@ nm_secret_agent_class_init (NMSecretAgentClass *config_class) /* virtual methods */ object_class->dispose = dispose; + object_class->finalize = finalize; }