summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2020-08-11 16:16:12 +0200
committerKarolin Seeger <kseeger@samba.org>2020-08-31 09:26:35 +0000
commit2eef42e690829cfbccc27368b1da0614f03da75e (patch)
tree8412b80601f4ce5d103811a7bc7647bde14c3351
parenta8dfc1ad59f662ff1f01192c91a8a7d169e0938b (diff)
downloadsamba-2eef42e690829cfbccc27368b1da0614f03da75e.tar.gz
tldap: Only free() ld->pending if "req" is part of it
Best reviewed with "git show -U10". We need to check that "req" is actually the last request that is being freed before freeing the whole array. Bug: https://bugzilla.samba.org/show_bug.cgi?id=14465 Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> (cherry picked from commit b85dbc9ccf80d8c19aff33c1da83954e5d6a37ef)
-rw-r--r--source3/lib/tldap.c10
1 files changed, 5 insertions, 5 deletions
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; i<num_pending; i++) {
if (req == ld->pending[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
*/