diff options
-rw-r--r-- | source4/dsdb/schema/schema_init.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c index 71d952b944..75457b4bea 100644 --- a/source4/dsdb/schema/schema_init.c +++ b/source4/dsdb/schema/schema_init.c @@ -1534,6 +1534,11 @@ int dsdb_set_global_schema(struct ldb_context *ldb) return ret; } + /* Keep a reference to this schema, just incase the global copy is replaced */ + if (talloc_reference(ldb, global_schema) == NULL) { + return LDB_ERR_OPERATIONS_ERROR; + } + return LDB_SUCCESS; } @@ -1571,6 +1576,10 @@ void dsdb_make_schema_global(struct ldb_context *ldb) return; } + if (global_schema) { + talloc_unlink(talloc_autofree_context(), schema); + } + talloc_steal(talloc_autofree_context(), schema); global_schema = schema; |