aboutsummaryrefslogtreecommitdiffstats
path: root/mail/session.c
diff options
context:
space:
mode:
Diffstat (limited to 'mail/session.c')
-rw-r--r--mail/session.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/mail/session.c b/mail/session.c
index 28694f39a1..42125c7b04 100644
--- a/mail/session.c
+++ b/mail/session.c
@@ -124,6 +124,7 @@ auth_callback (CamelAuthCallbackMode mode, char *data, gboolean secret,
{
char *key, *ans, *url;
gboolean accept;
+ gpointer old_key, old_data;
if (service) {
url = camel_url_to_string (service->url, CAMEL_URL_HIDE_PASSWORD | CAMEL_URL_HIDE_PARAMS);
@@ -134,20 +135,18 @@ auth_callback (CamelAuthCallbackMode mode, char *data, gboolean secret,
switch (mode) {
case CAMEL_AUTHENTICATOR_TELL:
+ if (g_hash_table_lookup_extended (passwords, key,
+ &old_key, &old_data)) {
+ g_free (old_data);
+ g_free (key);
+ key = old_key;
+ }
+
if (!data) {
g_hash_table_remove (passwords, key);
g_free (key);
} else {
- gpointer old_key, old_data;
-
- if (g_hash_table_lookup_extended (passwords, key,
- &old_key,
- &old_data)) {
- g_hash_table_insert (passwords, old_key, data);
- g_free (old_data);
- g_free (key);
- } else
- g_hash_table_insert (passwords, key, data);
+ g_hash_table_insert (passwords, key, data);
}
return NULL;