From 6addde849f3317fc6671477202ce9a0b712c28a3 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 6 Feb 2006 00:39:05 +0000 Subject: r13360: Fix crash bug when 0 results are returned on the internal base search (This used to be commit fbee725ae87efbcf5887c923d55d7cb0d05476a6) --- source4/lib/ldb/modules/asq.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'source4/lib/ldb/modules/asq.c') 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); } -- cgit