summaryrefslogtreecommitdiff
path: root/source4/dsdb/kcc
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/kcc
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/kcc')
-rw-r--r--source4/dsdb/kcc/kcc_connection.c4
-rw-r--r--source4/dsdb/kcc/kcc_periodic.c2
-rw-r--r--source4/dsdb/kcc/kcc_topology.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/source4/dsdb/kcc/kcc_connection.c b/source4/dsdb/kcc/kcc_connection.c
index 266f753c37..ea6383342c 100644
--- a/source4/dsdb/kcc/kcc_connection.c
+++ b/source4/dsdb/kcc/kcc_connection.c
@@ -51,7 +51,7 @@ static int kccsrv_add_connection(struct kccsrv_service *s,
ret = LDB_ERR_OPERATIONS_ERROR;
goto done;
}
- new_dn = samdb_ntds_settings_dn(s->samdb);
+ new_dn = samdb_ntds_settings_dn(s->samdb, tmp_ctx);
if (!new_dn) {
DEBUG(0, ("failed to find NTDS settings\n"));
ret = LDB_ERR_OPERATIONS_ERROR;
@@ -198,7 +198,7 @@ struct kcc_connection_list *kccsrv_find_connections(struct kccsrv_service *s,
return NULL;
}
- base_dn = samdb_ntds_settings_dn(s->samdb);
+ base_dn = samdb_ntds_settings_dn(s->samdb, tmp_ctx);
if (!base_dn) {
DEBUG(0, ("failed to find our own NTDS settings DN\n"));
talloc_free(tmp_ctx);
diff --git a/source4/dsdb/kcc/kcc_periodic.c b/source4/dsdb/kcc/kcc_periodic.c
index e3792300de..f96347f423 100644
--- a/source4/dsdb/kcc/kcc_periodic.c
+++ b/source4/dsdb/kcc/kcc_periodic.c
@@ -392,7 +392,7 @@ static int kccsrv_gc_update(struct kccsrv_service *s, struct ldb_result *res)
}
/* get a list of what NCs we are already replicating */
- ret = dsdb_search_dn(s->samdb, tmp_ctx, &res2, samdb_ntds_settings_dn(s->samdb), attrs2, 0);
+ ret = dsdb_search_dn(s->samdb, tmp_ctx, &res2, samdb_ntds_settings_dn(s->samdb, tmp_ctx), attrs2, 0);
if (ret != LDB_SUCCESS) {
DEBUG(1,("Failed to get our NC list attributes for GC update - %s\n", ldb_errstring(s->samdb)));
talloc_free(tmp_ctx);
diff --git a/source4/dsdb/kcc/kcc_topology.c b/source4/dsdb/kcc/kcc_topology.c
index 9697ec12f7..2a9f2dd15c 100644
--- a/source4/dsdb/kcc/kcc_topology.c
+++ b/source4/dsdb/kcc/kcc_topology.c
@@ -1007,7 +1007,7 @@ static NTSTATUS kcctpl_bridgehead_dc_failed(struct ldb_context *ldb,
tmp_ctx = talloc_new(ldb);
NT_STATUS_HAVE_NO_MEMORY(tmp_ctx);
- settings_dn = samdb_ntds_settings_dn(ldb);
+ settings_dn = samdb_ntds_settings_dn(ldb, tmp_ctx);
if (!settings_dn) {
DEBUG(1, (__location__ ": failed to find our own NTDS Settings "
"DN\n"));