Author: abartlet Date: 2007-11-06 03:46:57 +0000 (Tue, 06 Nov 2007) New Revision: 25856
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25856 Log: If the search fails, it is not valid to steal 'res'. Andrew Bartlett Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_modules.c Changeset: Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_modules.c =================================================================== --- branches/SAMBA_4_0/source/lib/ldb/common/ldb_modules.c 2007-11-06 03:43:50 UTC (rev 25855) +++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_modules.c 2007-11-06 03:46:57 UTC (rev 25856) @@ -322,15 +322,16 @@ } 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);