summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-04-18 17:19:02 +0200
committerThomas Haller <thaller@redhat.com>2016-04-19 13:47:42 +0200
commit4003edbbf91910d9da55e68381d5eb164ca9669c (patch)
tree5e58551caf3167b3aa3d8e60df083410abc54c7f
parent6878999ca388bc747e1a9546837f82929cb7575c (diff)
downloadNetworkManager-4003edbbf91910d9da55e68381d5eb164ca9669c.tar.gz
libnm/vpn: clear internal "keyfile" from NMVpnPluginInfo
The GKeyFile is no longer needed after constuction. All strings are copied over to the "keys" hash.
-rw-r--r--libnm-core/nm-vpn-plugin-info.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libnm-core/nm-vpn-plugin-info.c b/libnm-core/nm-vpn-plugin-info.c
index 430f9125ed..2e6275e341 100644
--- a/libnm-core/nm-vpn-plugin-info.c
+++ b/libnm-core/nm-vpn-plugin-info.c
@@ -877,15 +877,16 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
for (j = 0; keys && keys[j]; j++) {
char *s;
- /* Lookup the value via get_string(). We want that behavior.
- * You could still lookup the original values via g_key_file_get_value()
- * based on priv->keyfile. */
+ /* Lookup the value via get_string(). We want that behavior for all our
+ * values. */
s = g_key_file_get_string (priv->keyfile, groups[i], keys[j], NULL);
if (s)
g_hash_table_insert (priv->keys, _nm_utils_strstrdictkey_create (groups[i], keys[j]), s);
}
}
+ g_clear_pointer (&priv->keyfile, g_key_file_unref);
+
return TRUE;
}
@@ -948,9 +949,10 @@ finalize (GObject *object)
g_free (priv->service);
g_strfreev (priv->aliases);
g_free (priv->filename);
- g_key_file_unref (priv->keyfile);
g_hash_table_unref (priv->keys);
+ g_clear_pointer (&priv->keyfile, g_key_file_unref);
+
G_OBJECT_CLASS (nm_vpn_plugin_info_parent_class)->finalize (object);
}