talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 8e40e71a285b8cfcf49b33caa842dc2d4ed439f0
parent 6c2eb37a0cef876017822a4ddae92c7af1125280
Author: Andrej Kacian <ticho@claws-mail.org>
Date:   Wed, 12 Apr 2017 17:36:07 +0200

Fix a memory leak around password field in editldap.c.

Diffstat:
Msrc/editldap.c | 11+++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/editldap.c b/src/editldap.c @@ -903,7 +903,7 @@ static void edit_ldap_clear_fields(void) { */ static void edit_ldap_set_fields( LdapServer *server ) { LdapControl *ctl; - gchar *crit; + gchar *crit, *pwd; if( ldapsvr_get_name( server ) ) gtk_entry_set_text(GTK_ENTRY(ldapedit.entry_name), @@ -919,8 +919,15 @@ static void edit_ldap_set_fields( LdapServer *server ) { if( ctl->bindDN ) gtk_entry_set_text( GTK_ENTRY(ldapedit.entry_bindDN), ctl->bindDN ); + + pwd = passwd_store_get(PWS_CORE, "LDAP", ctl->hostName); gtk_entry_set_text( GTK_ENTRY(ldapedit.entry_bindPW), - passwd_store_get(PWS_CORE, "LDAP", ctl->hostName)); + (pwd ? pwd : "")); + if (pwd != NULL) { + memset(pwd, 0, strlen(pwd)); + g_free(pwd); + } + gtk_spin_button_set_value( GTK_SPIN_BUTTON(ldapedit.spinbtn_timeout), ctl->timeOut ); gtk_spin_button_set_value(