1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

s4:ldb Fix segfault in ldbsearch store_referral callback

sctx->refs_store was not initialised, and that made talloc_realloc
grumpy once we started actually returning referrals regularly from
Samba4's partitions module (0be57c7478
by mdw).

We now just use talloc_zero() and forget about this manual
initialisation work.  Tracking down use of uninitialised variables
with valgrind was the grand idea when this started, but in practice we
just get segfaults in unusual places.

Andrew Bartlett
This commit is contained in:
Andrew Bartlett 2010-02-25 11:46:41 +11:00
parent 26891651ec
commit 3c202519ec

View File

@ -191,21 +191,16 @@ static int do_search(struct ldb_context *ldb,
req = NULL;
sctx = talloc(ldb, struct search_context);
sctx = talloc_zero(ldb, struct search_context);
if (!sctx) return -1;
sctx->ldb = ldb;
sctx->sort = options->sorted;
sctx->num_stored = 0;
sctx->refs_stored = 0;
sctx->store = NULL;
sctx->req_ctrls = ldb_parse_control_strings(ldb, sctx, (const char **)options->controls);
if (options->controls != NULL && sctx->req_ctrls== NULL) {
printf("parsing controls failed: %s\n", ldb_errstring(ldb));
return -1;
}
sctx->entries = 0;
sctx->refs = 0;
if (basedn == NULL) {
basedn = ldb_get_default_basedn(ldb);