use talloc with the global schema consistently
authorAndrew Tridgell <tridge@samba.org>
Fri, 7 Aug 2009 07:16:26 +0000 (17:16 +1000)
committerAndrew Tridgell <tridge@samba.org>
Fri, 7 Aug 2009 07:24:48 +0000 (17:24 +1000)
Before this change, the first opener of the sam ldb context would
become the owner of the global schema, then the autofree context got a
reference to the schema. Any subsequent opens of the sam ldb also got
a reference. This meant that the talloc hierarchy was inconsistent
between the first sam ldb open and subsequent opens. With this change
the autofree context becomes the owner of the global schema, and all
ldb contexts get a reference.

source4/dsdb/schema/schema_set.c

index 5ded04e9da1ef53243c7fe63addcb12601d723f9..5d78d0a0c687e64c38ac3dcc8992a5ea1c977c86 100644 (file)
@@ -437,7 +437,8 @@ void dsdb_make_schema_global(struct ldb_context *ldb)
        }
 
        /* we want the schema to be around permanently */
-       talloc_reference(talloc_autofree_context(), schema);
+       talloc_reparent(talloc_parent(schema), talloc_autofree_context(), schema);
+
        global_schema = schema;
 
        dsdb_set_global_schema(ldb);