summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-10-15 16:55:40 -0700
committerJeremy Allison <jra@samba.org>2009-10-15 16:55:40 -0700
commit5cc895983d9d9e9a0acfaa6a3dfa97f14d9d94c6 (patch)
tree6783d91d773b622da8b6876713142c0ea0e1f252 /source3/lib
parenta6e4cb500b4162cae1d906a1762507370b4ee89e (diff)
downloadsamba-5cc895983d9d9e9a0acfaa6a3dfa97f14d9d94c6.tar.gz
samba-5cc895983d9d9e9a0acfaa6a3dfa97f14d9d94c6.tar.bz2
samba-5cc895983d9d9e9a0acfaa6a3dfa97f14d9d94c6.zip
Fix valgrind memory leak in bug #6814 - Fixes for problems reported by valgrind
Jeremy.
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/smbldap.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c
index 47b2208880..7287e3d998 100644
--- a/source3/lib/smbldap.c
+++ b/source3/lib/smbldap.c
@@ -1054,12 +1054,18 @@ static int smbldap_connect_system(struct smbldap_state *ldap_state, LDAP * ldap_
int version;
if (!ldap_state->anonymous && !ldap_state->bind_dn) {
+ char *bind_dn = NULL;
+ char *bind_secret = NULL;
/* get the default dn and password only if they are not set already */
- if (!fetch_ldap_pw(&ldap_state->bind_dn, &ldap_state->bind_secret)) {
+ if (!fetch_ldap_pw(&bind_dn, &bind_secret)) {
DEBUG(0, ("ldap_connect_system: Failed to retrieve password from secrets.tdb\n"));
return LDAP_INVALID_CREDENTIALS;
}
+ smbldap_set_creds(ldap_state, false, bind_dn, bind_secret);
+ SAFE_FREE(bind_dn);
+ memset(bind_secret, '\0', strlen(bind_secret));
+ SAFE_FREE(bind_secret);
}
/* removed the sasl_bind_s "EXTERNAL" stuff, as my testsuite