summaryrefslogtreecommitdiff
path: root/source3/winbindd/winbindd_cm.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2013-09-04 13:39:31 -0700
committerJeremy Allison <jra@samba.org>2013-09-05 09:17:13 -0700
commit6b915bfd0f4194453c1b01158f2c2772b2a2df2f (patch)
treec1fcb0b1b0ff7abba4d2e27b7b853ce9b6926ed3 /source3/winbindd/winbindd_cm.c
parent8a7246ac2c5b27cc29e6ca23c1e2e0f43e298eb5 (diff)
downloadsamba-6b915bfd0f4194453c1b01158f2c2772b2a2df2f.tar.gz
samba-6b915bfd0f4194453c1b01158f2c2772b2a2df2f.tar.bz2
samba-6b915bfd0f4194453c1b01158f2c2772b2a2df2f.zip
Add a talloc context to saf_fetch().
Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
Diffstat (limited to 'source3/winbindd/winbindd_cm.c')
-rw-r--r--source3/winbindd/winbindd_cm.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c
index 0b8308a5e3..bf0e70d20b 100644
--- a/source3/winbindd/winbindd_cm.c
+++ b/source3/winbindd/winbindd_cm.c
@@ -1549,15 +1549,16 @@ static NTSTATUS cm_open_connection(struct winbindd_domain *domain,
{
TALLOC_CTX *mem_ctx;
NTSTATUS result;
- char *saf_servername = saf_fetch( domain->name );
+ char *saf_servername;
int retries;
if ((mem_ctx = talloc_init("cm_open_connection")) == NULL) {
- SAFE_FREE(saf_servername);
set_domain_offline(domain);
return NT_STATUS_NO_MEMORY;
}
+ saf_servername = saf_fetch(mem_ctx, domain->name );
+
/* we have to check the server affinity cache here since
later we select a DC based on response time and not preference */
@@ -1577,13 +1578,14 @@ static NTSTATUS cm_open_connection(struct winbindd_domain *domain,
if (!interpret_string_addr(&ss, saf_servername,
AI_NUMERICHOST)) {
+ TALLOC_FREE(mem_ctx);
return NT_STATUS_UNSUCCESSFUL;
}
if (dcip_to_name(mem_ctx, domain, &ss, &dcname)) {
domain->dcname = talloc_strdup(domain,
dcname);
if (domain->dcname == NULL) {
- SAFE_FREE(saf_servername);
+ TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
} else {
@@ -1594,12 +1596,10 @@ static NTSTATUS cm_open_connection(struct winbindd_domain *domain,
} else {
domain->dcname = talloc_strdup(domain, saf_servername);
if (domain->dcname == NULL) {
- SAFE_FREE(saf_servername);
+ TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
}
-
- SAFE_FREE( saf_servername );
}
for (retries = 0; retries < 3; retries++) {