aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-account-settings.c
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-08-23 00:44:14 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-08-23 01:54:39 +0800
commitc10e3fbca90c684a3f0988a119cfad3d14def218 (patch)
tree57e9f19427d669c2ebf061870ab9dd9e5cab6d8f /libempathy/empathy-account-settings.c
parent4174547fb3fcc5d9447b20728a3fb086cf90b9e0 (diff)
downloadgsoc2013-empathy-c10e3fbca90c684a3f0988a119cfad3d14def218.tar
gsoc2013-empathy-c10e3fbca90c684a3f0988a119cfad3d14def218.tar.gz
gsoc2013-empathy-c10e3fbca90c684a3f0988a119cfad3d14def218.tar.bz2
gsoc2013-empathy-c10e3fbca90c684a3f0988a119cfad3d14def218.tar.lz
gsoc2013-empathy-c10e3fbca90c684a3f0988a119cfad3d14def218.tar.xz
gsoc2013-empathy-c10e3fbca90c684a3f0988a119cfad3d14def218.tar.zst
gsoc2013-empathy-c10e3fbca90c684a3f0988a119cfad3d14def218.zip
Fix some leaks in _settings_discard
Prevent leaking the unset parameter names when unsetting the array. Also use it as a general utility function in other parts of the code
Diffstat (limited to 'libempathy/empathy-account-settings.c')
-rw-r--r--libempathy/empathy-account-settings.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/libempathy/empathy-account-settings.c b/libempathy/empathy-account-settings.c
index f6c1af42c..efcbb2d8e 100644
--- a/libempathy/empathy-account-settings.c
+++ b/libempathy/empathy-account-settings.c
@@ -630,14 +630,8 @@ empathy_account_settings_discard_changes (EmpathyAccountSettings *settings)
{
EmpathyAccountSettingsPriv *priv = GET_PRIV (settings);
- if (g_hash_table_size (priv->parameters) > 0)
- g_hash_table_remove_all (priv->parameters);
-
- if (priv->unset_parameters->len > 0)
- {
- g_array_remove_range (priv->unset_parameters, 0,
- priv->unset_parameters->len);
- }
+ g_hash_table_remove_all (priv->parameters);
+ empathy_account_settings_free_unset_parameters (settings);
}
const gchar *
@@ -967,6 +961,10 @@ empathy_account_settings_account_updated (GObject *source,
g_simple_async_result_set_from_error (priv->apply_result, error);
g_error_free (error);
}
+ else
+ {
+ empathy_account_settings_discard_changes (settings);
+ }
r = priv->apply_result;
priv->apply_result = NULL;
@@ -990,9 +988,14 @@ empathy_account_settings_created_cb (GObject *source,
EMPATHY_ACCOUNT_MANAGER (source), result, &error);
if (account == NULL)
- g_simple_async_result_set_from_error (priv->apply_result, error);
+ {
+ g_simple_async_result_set_from_error (priv->apply_result, error);
+ }
else
- priv->account = g_object_ref (account);
+ {
+ priv->account = g_object_ref (account);
+ empathy_account_settings_discard_changes (settings);
+ }
r = priv->apply_result;
priv->apply_result = NULL;
@@ -1111,9 +1114,6 @@ empathy_account_settings_apply_async (EmpathyAccountSettings *settings,
empathy_account_update_settings_async (priv->account,
priv->parameters, (const gchar **)priv->unset_parameters->data,
empathy_account_settings_account_updated, settings);
-
- g_hash_table_remove_all (priv->parameters);
- empathy_account_settings_free_unset_parameters (settings);
}
}