From 5ccf92420b1b396104eb1bc8361510a44beb255a Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 15 Jan 2010 22:10:46 -0500 Subject: Fix a potential uninitialized variable use in emae_authtype_changed(). Caught by the Clang Static Analyzer. --- mail/em-account-editor.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'mail') diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c index 6d25004f23..42a6063870 100644 --- a/mail/em-account-editor.c +++ b/mail/em-account-editor.c @@ -1748,8 +1748,8 @@ emae_authtype_changed (GtkComboBox *dropdown, EMAccountEditorService *service) gint id = gtk_combo_box_get_active (dropdown); GtkTreeModel *model; GtkTreeIter iter; - CamelServiceAuthType *authtype; CamelURL *url; + gboolean sensitive = FALSE; if (id == -1) return; @@ -1759,19 +1759,24 @@ emae_authtype_changed (GtkComboBox *dropdown, EMAccountEditorService *service) url = emae_account_url (service->emae, emae_service_info[service->type].account_uri_key); model = gtk_combo_box_get_model (dropdown); if (gtk_tree_model_iter_nth_child (model, &iter, NULL, id)) { + CamelServiceAuthType *authtype; + gtk_tree_model_get (model, &iter, 1, &authtype, -1); if (authtype) camel_url_set_authmech (url, authtype->authproto); else camel_url_set_authmech (url, NULL); emae_uri_changed (service, url); + + sensitive = + authtype != NULL && + authtype->need_password && + e_account_writable (account, + emae_service_info[service->type].save_passwd_key); } camel_url_free (url); - gtk_widget_set_sensitive ((GtkWidget *)service->remember, - authtype - ?(authtype->need_password && e_account_writable (account, emae_service_info[service->type].save_passwd_key)) - :FALSE); + gtk_widget_set_sensitive ((GtkWidget *)service->remember, sensitive); } static void -- cgit v1.2.3