summaryrefslogtreecommitdiff
path: root/source4/lib/ldb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2007-11-06 03:46:57 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:44:29 +0100
commite3198b3acde1f737266ce2b1de738f08314d530c (patch)
tree96c833d9a2e5f58b06807f25bc91c18a1727575f /source4/lib/ldb
parent145bc26a0f58943cfa41fe2955fc7258e6bb6f54 (diff)
downloadsamba-e3198b3acde1f737266ce2b1de738f08314d530c.tar.gz
samba-e3198b3acde1f737266ce2b1de738f08314d530c.tar.bz2
samba-e3198b3acde1f737266ce2b1de738f08314d530c.zip
r25856: If the search fails, it is not valid to steal 'res'.
Andrew Bartlett (This used to be commit f4d733c3d00c90ac2e02fcc202240ae7c290463e)
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r--source4/lib/ldb/common/ldb_modules.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c
index 87e5b2eeb3..2ffd49786b 100644
--- a/source4/lib/ldb/common/ldb_modules.c
+++ b/source4/lib/ldb/common/ldb_modules.c
@@ -322,15 +322,16 @@ int ldb_load_modules(struct ldb_context *ldb, const char *options[])
}
ret = ldb_search(ldb, mods_dn, LDB_SCOPE_BASE, "", attrs, &res);
+
+ if (ret != LDB_SUCCESS) {
+ ldb_debug(ldb, LDB_DEBUG_FATAL, "ldb error (%s) occurred searching for modules, bailing out\n", ldb_errstring(ldb));
+ talloc_free(mem_ctx);
+ return -1;
+ }
talloc_steal(mods_dn, res);
- if (ret == LDB_SUCCESS && (res->count == 0 || res->msgs[0]->num_elements == 0)) {
+ if (res->count == 0 || res->msgs[0]->num_elements == 0) {
ldb_debug(ldb, LDB_DEBUG_TRACE, "no modules required by the db");
} else {
- if (ret != LDB_SUCCESS) {
- ldb_debug(ldb, LDB_DEBUG_FATAL, "ldb error (%s) occurred searching for modules, bailing out\n", ldb_errstring(ldb));
- talloc_free(mem_ctx);
- return -1;
- }
if (res->count > 1) {
ldb_debug(ldb, LDB_DEBUG_FATAL, "Too many records found (%d), bailing out\n", res->count);
talloc_free(mem_ctx);