diff options
-rw-r--r-- | source3/passdb/pdb_ldap.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index 17803a37ed..84ac6c576a 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -1897,13 +1897,16 @@ static NTSTATUS ldapsam_add_group_mapping_entry(struct pdb_methods *methods, rc = ldapsam_search_one_group_by_gid(ldap_state, map->gid, &result); if (rc != LDAP_SUCCESS) { + ldap_msgfree(result); return NT_STATUS_UNSUCCESSFUL; } count = ldap_count_entries(ldap_state->smbldap_state->ldap_struct, result); - if ( count == 0 ) + if ( count == 0 ) { + ldap_msgfree(result); return NT_STATUS_UNSUCCESSFUL; + } if (count > 1) { DEBUG(2, ("Group %i must exist exactly once in LDAP\n", |