summaryrefslogtreecommitdiff
path: root/source4/lib/ldb
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-02-06 00:39:05 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:51:50 -0500
commit6addde849f3317fc6671477202ce9a0b712c28a3 (patch)
tree9cfb4b8cdee4a29dd8a57a4b3d46c47611258a77 /source4/lib/ldb
parent5b26ea841cb87500d46cb39ee05000994bcfccbe (diff)
downloadsamba-6addde849f3317fc6671477202ce9a0b712c28a3.tar.gz
samba-6addde849f3317fc6671477202ce9a0b712c28a3.tar.bz2
samba-6addde849f3317fc6671477202ce9a0b712c28a3.zip
r13360: Fix crash bug when 0 results are returned on the internal base search
(This used to be commit fbee725ae87efbcf5887c923d55d7cb0d05476a6)
Diffstat (limited to 'source4/lib/ldb')
-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);
}