libnm/vpn: clear internal "keyfile" from NMVpnPluginInfo

The GKeyFile is no longer needed after constuction. All strings are
copied over to the "keys" hash.
This commit is contained in:
Thomas Haller 2016-04-18 17:19:02 +02:00
parent 6878999ca3
commit 4003edbbf9

View file

@ -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);
}