diff options
Diffstat (limited to 'source3/winbindd')
-rw-r--r-- | source3/winbindd/winbindd_ads.c | 4 | ||||
-rw-r--r-- | source3/winbindd/winbindd_cm.c | 12 |
2 files changed, 9 insertions, 7 deletions
diff --git a/source3/winbindd/winbindd_ads.c b/source3/winbindd/winbindd_ads.c index 4c2638900f..18749c97c4 100644 --- a/source3/winbindd/winbindd_ads.c +++ b/source3/winbindd/winbindd_ads.c @@ -151,7 +151,7 @@ ADS_STATUS ads_idmap_cached_connection(ADS_STRUCT **adsp, const char *dom_name) * Check if we can get server nam and realm from SAF cache * and the domain list. */ - ldap_server = saf_fetch(dom_name); + ldap_server = saf_fetch(talloc_tos(), dom_name); DEBUG(10, ("ldap_server from saf cache: '%s'\n", ldap_server ? ldap_server : "")); @@ -165,6 +165,7 @@ ADS_STATUS ads_idmap_cached_connection(ADS_STRUCT **adsp, const char *dom_name) " domain '%s'\n", wb_dom->alt_name, dom_name)); if (!get_trust_pw_clear(dom_name, &password, NULL, NULL)) { + TALLOC_FREE(ldap_server); return ADS_ERROR_NT(NT_STATUS_CANT_ACCESS_DOMAIN_INFO); } @@ -190,6 +191,7 @@ ADS_STATUS ads_idmap_cached_connection(ADS_STRUCT **adsp, const char *dom_name) status = ads_cached_connection_connect(adsp, realm, dom_name, ldap_server, password, realm, 0); SAFE_FREE(realm); + TALLOC_FREE(ldap_server); return status; } 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++) { |