summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/passdb/pdb_ldap.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index b81d1e6b92..d2b4f4fbba 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -4441,12 +4441,6 @@ static bool ldapsam_search_firstpage(struct pdb_search *search)
}
state->current_entry = ldap_first_entry(ld, state->entries);
- if (state->current_entry == NULL) {
- ldap_msgfree(state->entries);
- state->entries = NULL;
- return false;
- }
-
return True;
}
@@ -4489,6 +4483,10 @@ static bool ldapsam_search_next_entry(struct pdb_search *search,
bool result;
retry:
+ if (state->current_entry == NULL) {
+ return false;
+ }
+
if ((state->entries == NULL) && (state->pagedresults_cookie == NULL))
return False;