ldb: Avoid individual memory allocations when searching for indexlist
authorAndrew Bartlett <abartlet@samba.org>
Mon, 24 Oct 2016 21:56:43 +0000 (10:56 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 1 Dec 2016 04:54:22 +0000 (05:54 +0100)
This reduces the talloc_free() cost when the ldb is terminated.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
lib/ldb/ldb_tdb/ldb_cache.c

index 2f19d276eceb60473e8e60689e3cbd543eb57278..8f70d4f91d71ec0d388885467fcfde84b49acfbe 100644 (file)
@@ -374,7 +374,10 @@ int ltdb_cache_load(struct ldb_module *module)
        indexlist_dn = ldb_dn_new(module, ldb, LTDB_INDEXLIST);
        if (indexlist_dn == NULL) goto failed;
 
-       r = ltdb_search_dn1(module, indexlist_dn, ltdb->cache->indexlist, 0);
+       r = ltdb_search_dn1(module, indexlist_dn, ltdb->cache->indexlist,
+                           LDB_UNPACK_DATA_FLAG_NO_DATA_ALLOC
+                           |LDB_UNPACK_DATA_FLAG_NO_VALUES_ALLOC
+                           |LDB_UNPACK_DATA_FLAG_NO_DN);
        if (r != LDB_SUCCESS && r != LDB_ERR_NO_SUCH_OBJECT) {
                goto failed;
        }