NetworkManager/0053-rh1061911-crash-dispose-NMSecretAgent.patch
Thomas Haller a24ad21471 core: diverse fixes
Resolves: #1054364
Resolves: #1061911
Resolves: #1063885
Resolves: #1080474
Resolves: #1084556
2014-04-08 19:09:15 +02:00

82 lines
2.4 KiB
Diff

From 2cea29f22882571ac92fedccd3cbe664d31eab10 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 11 Feb 2014 13:58:17 +0100
Subject: [PATCH 1/1] 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
(cherry picked from commit 4141e69b3a368f5b450fbc99a37557f77ef2fd08)
Conflicts:
src/settings/nm-secret-agent.c
---
src/settings/nm-secret-agent.c | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a/src/settings/nm-secret-agent.c b/src/settings/nm-secret-agent.c
index 5a8a73f..c7c1a26 100644
--- a/src/settings/nm-secret-agent.c
+++ b/src/settings/nm-secret-agent.c
@@ -40,8 +40,6 @@ G_DEFINE_TYPE (NMSecretAgent, nm_secret_agent, G_TYPE_OBJECT)
NMSecretAgentPrivate))
typedef struct {
- gboolean disposed;
-
char *description;
char *owner;
char *identifier;
@@ -499,25 +497,25 @@ nm_secret_agent_init (NMSecretAgent *self)
static void
dispose (GObject *object)
{
- NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (object);
-
- if (!priv->disposed) {
- priv->disposed = TRUE;
+ proxy_cleanup (NM_SECRET_AGENT (object));
- g_free (priv->description);
- g_free (priv->owner);
- g_free (priv->identifier);
- g_free (priv->owner_username);
+ G_OBJECT_CLASS (nm_secret_agent_parent_class)->dispose (object);
+}
- g_slist_foreach (priv->permissions, (GFunc) g_free, NULL);
- g_slist_free (priv->permissions);
+static void
+finalize (GObject *object)
+{
+ NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (object);
- g_hash_table_destroy (priv->requests);
+ g_free (priv->description);
+ g_free (priv->owner);
+ g_free (priv->identifier);
+ g_free (priv->owner_username);
- proxy_cleanup (NM_SECRET_AGENT (object));
- }
+ g_slist_free_full (priv->permissions, g_free);
+ g_hash_table_destroy (priv->requests);
- G_OBJECT_CLASS (nm_secret_agent_parent_class)->dispose (object);
+ G_OBJECT_CLASS (nm_secret_agent_parent_class)->finalize (object);
}
static void
@@ -529,5 +527,6 @@ nm_secret_agent_class_init (NMSecretAgentClass *config_class)
/* virtual methods */
object_class->dispose = dispose;
+ object_class->finalize = finalize;
}
--
1.9.0