1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-28 07:21:54 +03:00

r25856: If the search fails, it is not valid to steal 'res'.

Andrew Bartlett
(This used to be commit f4d733c3d0)
This commit is contained in:
Andrew Bartlett 2007-11-06 03:46:57 +01:00 committed by Stefan Metzmacher
parent 145bc26a0f
commit e3198b3acd

View File

@ -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);
talloc_steal(mods_dn, res);
if (ret == LDB_SUCCESS && (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;
}
talloc_steal(mods_dn, res);
if (res->count == 0 || res->msgs[0]->num_elements == 0) {
ldb_debug(ldb, LDB_DEBUG_TRACE, "no modules required by the db");
} else {
if (res->count > 1) {
ldb_debug(ldb, LDB_DEBUG_FATAL, "Too many records found (%d), bailing out\n", res->count);
talloc_free(mem_ctx);