summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-06-05 10:38:58 +0200
committerVolker Lendecke <vl@samba.org>2008-06-05 10:56:18 +0200
commitbde7cbf4a7f734b1f092825f52de618cfd563e1e (patch)
treeb26eebce4347951a84ec095f337787960e6ce218
parentd261e16cfd4afc19db0c26cfb2b6389c9c174310 (diff)
downloadsamba-bde7cbf4a7f734b1f092825f52de618cfd563e1e.tar.gz
samba-bde7cbf4a7f734b1f092825f52de618cfd563e1e.tar.bz2
samba-bde7cbf4a7f734b1f092825f52de618cfd563e1e.zip
Fix a memleak caused by a crappy get_sorted_dc_list() API
(This used to be commit 2ea03a1e95a30e321e390bef9408a1215711de07)
-rw-r--r--source3/winbindd/winbindd_cm.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c
index 312d30371f..ae51c268bd 100644
--- a/source3/winbindd/winbindd_cm.c
+++ b/source3/winbindd/winbindd_cm.c
@@ -1167,9 +1167,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<iplist_size; i++ ) {
char addr[INET6_ADDRSTRLEN];
@@ -1202,6 +1213,8 @@ static bool get_dcs(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain,
dcs,
num_dcs);
}
+ SAFE_FREE(ip_list);
+ iplist_size = 0;
}
/* try standard netbios queries if no ADS */