From e8b7162415d0869eb302847cf4ce31e45438999f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 26 Aug 2020 12:00:00 -0700 Subject: [PATCH] s3: winbindd: Move callers of get_sorted_dc_list() -> get_sorted_dc_list_talloc(). Signed-off-by: Jeremy Allison Reviewed-by: Noel Power --- source3/winbindd/winbindd_cm.c | 42 +++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index 854c227ad9d..00b0bd8a336 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -1536,8 +1536,8 @@ static bool get_dcs(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain, fstring dcname; struct sockaddr_storage ss; struct ip_service *ip_list = NULL; - int iplist_size = 0; - int i; + size_t iplist_size = 0; + size_t i; bool is_our_domain; enum security_types sec = (enum security_types)lp_security(); @@ -1574,8 +1574,12 @@ static bool get_dcs(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain, if (sitename) { /* Do the site-specific AD dns lookup first. */ - get_sorted_dc_list(domain->alt_name, sitename, &ip_list, - &iplist_size, True); + (void)get_sorted_dc_list_talloc(mem_ctx, + domain->alt_name, + sitename, + &ip_list, + &iplist_size, + true); /* Add ips to the DC array. We don't look up the name of the DC in this function, but we fill in the char* @@ -1593,14 +1597,18 @@ static bool get_dcs(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain, num_dcs); } - SAFE_FREE(ip_list); + TALLOC_FREE(ip_list); TALLOC_FREE(sitename); iplist_size = 0; } /* Now we add DCs from the main AD DNS lookup. */ - get_sorted_dc_list(domain->alt_name, NULL, &ip_list, - &iplist_size, True); + (void)get_sorted_dc_list_talloc(mem_ctx, + domain->alt_name, + NULL, + &ip_list, + &iplist_size, + true); for ( i=0; iname, NULL, &ip_list, &iplist_size, - false); + (void)get_sorted_dc_list_talloc(mem_ctx, + domain->name, + NULL, + &ip_list, + &iplist_size, + false); if (iplist_size == 0) { if (domain->alt_name != NULL) { - get_sorted_dc_list(domain->alt_name, NULL, &ip_list, - &iplist_size, true); + (void)get_sorted_dc_list_talloc(mem_ctx, + domain->alt_name, + NULL, + &ip_list, + &iplist_size, + true); } } @@ -1642,7 +1658,7 @@ static bool get_dcs(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain, num_dcs); } - SAFE_FREE(ip_list); + TALLOC_FREE(ip_list); iplist_size = 0; } -- 2.47.3