diff --git a/source3/lib/tldap.c b/source3/lib/tldap.c index bf5fc05d785..9da0e0c086e 100644 --- a/source3/lib/tldap.c +++ b/source3/lib/tldap.c @@ -492,11 +492,6 @@ static void tldap_msg_unset_pending(struct tevent_req *req) tevent_req_set_cleanup_fn(req, NULL); - if (num_pending == 1) { - TALLOC_FREE(ld->pending); - return; - } - for (i=0; ipending[i]) { break; @@ -511,6 +506,11 @@ static void tldap_msg_unset_pending(struct tevent_req *req) return; } + if (num_pending == 1) { + TALLOC_FREE(ld->pending); + return; + } + /* * Remove ourselves from the cli->pending array */