From: Jeremy Allison Date: Wed, 26 Aug 2020 18:56:00 +0000 (-0700) Subject: s3: net lookup: Move callers of get_sorted_dc_list() -> get_sorted_dc_list_talloc(). X-Git-Tag: talloc-2.3.2~618 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d6c3c2dea223f22c3c3166de1a2d100376ee02a;p=thirdparty%2Fsamba.git s3: net lookup: Move callers of get_sorted_dc_list() -> get_sorted_dc_list_talloc(). Signed-off-by: Jeremy Allison Reviewed-by: Noel Power --- diff --git a/source3/utils/net_lookup.c b/source3/utils/net_lookup.c index 594a87d8816..5ec15b94b2c 100644 --- a/source3/utils/net_lookup.c +++ b/source3/utils/net_lookup.c @@ -183,7 +183,7 @@ static int net_lookup_ldap(struct net_context *c, int argc, const char **argv) static int net_lookup_dc(struct net_context *c, int argc, const char **argv) { - struct ip_service *ip_list; + struct ip_service *ip_list = NULL; struct sockaddr_storage ss; char *pdc_str = NULL; const char *domain = NULL; @@ -192,6 +192,7 @@ static int net_lookup_dc(struct net_context *c, int argc, const char **argv) size_t i; char addr[INET6_ADDRSTRLEN]; bool sec_ads = (lp_security() == SEC_ADS); + NTSTATUS status; if (sec_ads) { domain = lp_realm(); @@ -213,8 +214,13 @@ static int net_lookup_dc(struct net_context *c, int argc, const char **argv) d_printf("%s\n", pdc_str); sitename = sitename_fetch(talloc_tos(), domain); - if (!NT_STATUS_IS_OK(get_sorted_dc_list(domain, sitename, - &ip_list, &count, sec_ads))) { + status = get_sorted_dc_list_talloc(talloc_tos(), + domain, + sitename, + &ip_list, + &count, + sec_ads); + if (!NT_STATUS_IS_OK(status)) { SAFE_FREE(pdc_str); TALLOC_FREE(sitename); return 0; @@ -225,6 +231,7 @@ static int net_lookup_dc(struct net_context *c, int argc, const char **argv) if (!strequal(pdc_str, addr)) d_printf("%s\n", addr); } + TALLOC_FREE(ip_list); SAFE_FREE(pdc_str); return 0; }