From cf8628e5858f2875cfccbac87eb9b02ef5f7228d Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 15 Jul 2003 17:00:11 +0000 Subject: Fix memleaks (This used to be commit 26134ac302f3296df6a65182f2585201a3ad833a) --- source3/passdb/pdb_ldap.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source3/passdb') diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index e32f566a7d..a4ee4dbd4b 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -1045,11 +1045,13 @@ static NTSTATUS ldapsam_getsampwnam(struct pdb_methods *my_methods, SAM_ACCOUNT DEBUG(4, ("Unable to locate user [%s] count=%d\n", sname, count)); + ldap_msgfree(result); return NT_STATUS_NO_SUCH_USER; } else if (count > 1) { DEBUG(1, ("Duplicate entries for this user [%s] Failing. count=%d\n", sname, count)); + ldap_msgfree(result); return NT_STATUS_NO_SUCH_USER; } @@ -1522,7 +1524,6 @@ static NTSTATUS ldapsam_add_sam_account(struct pdb_methods *my_methods, SAM_ACCO rc = smbldap_search_suffix(ldap_state->smbldap_state, filter, attr_list, &result); - free_attr_list( attr_list ); if ( rc != LDAP_SUCCESS ) { free_attr_list( attr_list ); @@ -1551,6 +1552,8 @@ static NTSTATUS ldapsam_add_sam_account(struct pdb_methods *my_methods, SAM_ACCO } } + free_attr_list( attr_list ); + if (num_result == 0) { /* Check if we need to add an entry */ DEBUG(3,("Adding new user\n")); @@ -1765,12 +1768,14 @@ static NTSTATUS ldapsam_getgroup(struct pdb_methods *methods, if (count < 1) { DEBUG(4, ("Did not find group\n")); + ldap_msgfree(result); return NT_STATUS_NO_SUCH_GROUP; } if (count > 1) { DEBUG(1, ("Duplicate entries for filter %s: count=%d\n", filter, count)); + ldap_msgfree(result); return NT_STATUS_NO_SUCH_GROUP; } -- cgit