summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/modules/asq.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/ldb/modules/asq.c')
-rw-r--r--source4/lib/ldb/modules/asq.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/source4/lib/ldb/modules/asq.c b/source4/lib/ldb/modules/asq.c
index 7e6bbdf29e..905bab480a 100644
--- a/source4/lib/ldb/modules/asq.c
+++ b/source4/lib/ldb/modules/asq.c
@@ -126,14 +126,22 @@ static int asq_search(struct ldb_module *module, struct ldb_request *req)
ret = ldb_request(module->ldb, base_req);
- if (ret != LDB_SUCCESS)
+ if (ret != LDB_SUCCESS) {
+ talloc_free(base_req);
return ret;
+ }
+ if (base_req->op.search.res->count == 0) {
+ talloc_free(base_req);
+ return build_response(res, ASQ_CTRL_SUCCESS);
+ }
+
/* look up the DNs */
el = ldb_msg_find_element(base_req->op.search.res->msgs[0],
asq_ctrl->source_attribute);
/* no values found */
if (el == NULL) {
+ talloc_free(base_req);
return build_response(res, ASQ_CTRL_SUCCESS);
}
@@ -181,6 +189,8 @@ static int asq_search(struct ldb_module *module, struct ldb_request *req)
talloc_free(exp_req);
}
+ talloc_free(base_req);
+
return build_response(res, ASQ_CTRL_SUCCESS);
}