ldb: Reduce per-attribute memory allocation during @ATTRIBUTES load
authorAndrew Bartlett <abartlet@samba.org>
Fri, 14 Oct 2016 02:42:53 +0000 (15:42 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 1 Dec 2016 04:54:23 +0000 (05:54 +0100)
This means we do just a few allocations, not multiple per configured attribute (there can be 1000s)

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

index 3d207c8f5f356189f8595a039d2cad0dfe000374..8e7112b873274ab96427cac5d8976e2b2dcb0b8d 100644 (file)
@@ -113,7 +113,10 @@ static int ltdb_attributes_load(struct ldb_module *module)
        dn = ldb_dn_new(module, ldb, LTDB_ATTRIBUTES);
        if (dn == NULL) goto failed;
 
-       r = ltdb_search_dn1(module, dn, attrs_msg, 0);
+       r = ltdb_search_dn1(module, dn, attrs_msg,
+                           LDB_UNPACK_DATA_FLAG_NO_DATA_ALLOC
+                           |LDB_UNPACK_DATA_FLAG_NO_VALUES_ALLOC
+                           |LDB_UNPACK_DATA_FLAG_NO_DN);
        talloc_free(dn);
        if (r != LDB_SUCCESS && r != LDB_ERR_NO_SUCH_OBJECT) {
                goto failed;