summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2008-07-25 11:58:24 +1000
committerAndrew Bartlett <abartlet@samba.org>2008-07-25 11:58:24 +1000
commit404846d8871d3d420e83a3e48625bb051faf893e (patch)
treefefc11abf075b035c714e9982dc64cf1e3c43b81
parent11798902dc51cd9eea3b7e8a0c94d0c0c08ed828 (diff)
downloadsamba-404846d8871d3d420e83a3e48625bb051faf893e.tar.gz
samba-404846d8871d3d420e83a3e48625bb051faf893e.tar.bz2
samba-404846d8871d3d420e83a3e48625bb051faf893e.zip
Try to avoid a memory leak if we re-set the global schema
However, try also not to pull a schema out from under a running ldb session. Andrew Bartlett (This used to be commit 7cf9b9dd0bb35835a7c6e9897ea99951a33c63c7)
-rw-r--r--source4/dsdb/schema/schema_init.c9
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;