summaryrefslogtreecommitdiff
path: root/source4/dsdb/repl/drepl_ridalloc.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-08-14 16:08:47 +1000
committerAndrew Bartlett <abartlet@samba.org>2012-08-14 10:05:14 +0200
commit956678685325a79a315f4ef19c0d834fd1747e4c (patch)
tree62b89848fbf552187a07d1d520702112f3b4ac45 /source4/dsdb/repl/drepl_ridalloc.c
parent0f2a87b547be43b4764c48350fd03ff22e086806 (diff)
downloadsamba-956678685325a79a315f4ef19c0d834fd1747e4c.tar.gz
samba-956678685325a79a315f4ef19c0d834fd1747e4c.tar.bz2
samba-956678685325a79a315f4ef19c0d834fd1747e4c.zip
s4-dsdb: Add mem_ctx argument to samdb_ntds_settings_dn
As this value is calculated new each time, we need to give it a context to live on. If the value is the forced value during provision, a reference is taken. This was responsible for the memory leak in the replication process. In the example I was given, this DN appeared in memory 13596 times! Andrew Bartlett Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Tue Aug 14 10:05:14 CEST 2012 on sn-devel-104
Diffstat (limited to 'source4/dsdb/repl/drepl_ridalloc.c')
-rw-r--r--source4/dsdb/repl/drepl_ridalloc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/source4/dsdb/repl/drepl_ridalloc.c b/source4/dsdb/repl/drepl_ridalloc.c
index 6dcd9efd8a..c817c319f2 100644
--- a/source4/dsdb/repl/drepl_ridalloc.c
+++ b/source4/dsdb/repl/drepl_ridalloc.c
@@ -95,7 +95,7 @@ static int drepl_ridalloc_pool_exhausted(struct ldb_context *ldb,
*exhausted = false;
*_alloc_pool = UINT64_MAX;
- server_dn = ldb_dn_get_parent(tmp_ctx, samdb_ntds_settings_dn(ldb));
+ server_dn = ldb_dn_get_parent(tmp_ctx, samdb_ntds_settings_dn(ldb, tmp_ctx));
if (!server_dn) {
talloc_free(tmp_ctx);
return ldb_operr(ldb);
@@ -208,7 +208,7 @@ WERROR dreplsrv_ridalloc_check_rid_pool(struct dreplsrv_service *service)
return WERR_DS_DRA_INTERNAL_ERROR;
}
- if (ldb_dn_compare(samdb_ntds_settings_dn(ldb), fsmo_role_dn) == 0) {
+ if (ldb_dn_compare(samdb_ntds_settings_dn(ldb, tmp_ctx), fsmo_role_dn) == 0) {
/* we are the RID Manager - no need to do a
DRSUAPI_EXOP_FSMO_RID_ALLOC */
talloc_free(tmp_ctx);