summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-11-16 09:34:19 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:28:15 -0500
commit84138215cade4bd427a4a04810696cbb89434928 (patch)
tree5b277d32e2f9efc98c63e1ba310f3f6575f663b5
parentadae413042e15e7228bcc25321913b38ae61358a (diff)
downloadsamba-84138215cade4bd427a4a04810696cbb89434928.tar.gz
samba-84138215cade4bd427a4a04810696cbb89434928.tar.bz2
samba-84138215cade4bd427a4a04810696cbb89434928.zip
r19732: The 'res' from ldb_search is only valid if the call returns LDB_SUCCESS.
This seems to show up (as an abort() from talloc) particularly under ldb_ildap. Andrew Bartlett (This used to be commit 9890af534d845d471d2a98268c408a907b29e016)
-rw-r--r--source4/dsdb/samdb/ldb_modules/samldb.c9
-rw-r--r--source4/scripting/ejs/smbcalls_ldb.c2
2 files changed, 7 insertions, 4 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c
index e86a3bfde4..3ce5cc1b5c 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -200,9 +200,12 @@ static struct ldb_dn *samldb_search_domain(struct ldb_module *module, TALLOC_CTX
do {
ret = ldb_search(module->ldb, sdn, LDB_SCOPE_BASE,
"(|(objectClass=domain)(objectClass=builtinDomain))", attrs, &res);
- talloc_steal(local_ctx, res);
- if (ret == LDB_SUCCESS && res->count == 1)
- break;
+ if (ret == LDB_SUCCESS) {
+ talloc_steal(local_ctx, res);
+ if (res->count == 1) {
+ break;
+ }
+ }
} while ((sdn = ldb_dn_get_parent(local_ctx, sdn)));
if (ret != LDB_SUCCESS || res->count != 1) {
diff --git a/source4/scripting/ejs/smbcalls_ldb.c b/source4/scripting/ejs/smbcalls_ldb.c
index f8296b9d36..0af9738b60 100644
--- a/source4/scripting/ejs/smbcalls_ldb.c
+++ b/source4/scripting/ejs/smbcalls_ldb.c
@@ -111,8 +111,8 @@ static int ejs_ldbSearch(MprVarHandle eid, int argc, struct MprVar **argv)
mpr_Return(eid, mprCreateUndefinedVar());
} else {
mpr_Return(eid, mprLdbArray(ldb, res->msgs, res->count, "ldb_message"));
+ talloc_free(res);
}
- talloc_free(res);
talloc_free(tmp_ctx);
return 0;