From ba10b9c077272c521504b3a638bba73446efc61c Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 5 Jun 2008 10:38:58 +0200 Subject: [PATCH] Fix a memleak caused by a crappy get_sorted_dc_list() API --- source/winbindd/winbindd_cm.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/source/winbindd/winbindd_cm.c b/source/winbindd/winbindd_cm.c index ec60cc193cd..25f59db245d 100644 --- a/source/winbindd/winbindd_cm.c +++ b/source/winbindd/winbindd_cm.c @@ -1161,9 +1161,20 @@ static bool get_dcs(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain, sitename = sitename_fetch(domain->alt_name); if (sitename) { + NTSTATUS status; /* Do the site-specific AD dns lookup first. */ - get_sorted_dc_list(domain->alt_name, sitename, &ip_list, &iplist_size, True); + status = get_sorted_dc_list(domain->alt_name, + sitename, &ip_list, + &iplist_size, True); + if (!NT_STATUS_IS_OK(status)) { + /* + * Work around a crappy about-to-be-replaced + * get_sorted_dc_list error handling :-) + */ + SAFE_FREE(ip_list); + iplist_size = 0; + } for ( i=0; i