Commit 397c2200 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

advapi32: Allocate temporary name buffer once.

parent bc52f1c0
......@@ -371,6 +371,7 @@ NTSTATUS WINAPI LsaLookupNames2( LSA_HANDLE policy, ULONG flags, ULONG count,
{
ULONG i, sid_size_total = 0, domain_size_max = 0, size, domainname_size_total = 0;
ULONG sid_size, domain_size, mapped;
LSA_UNICODE_STRING domain;
BOOL handled = FALSE;
char *domain_data;
SID_NAME_USE use;
......@@ -414,13 +415,11 @@ NTSTATUS WINAPI LsaLookupNames2( LSA_HANDLE policy, ULONG flags, ULONG count,
(*domains)->Domains = (LSA_TRUST_INFORMATION*)((char*)*domains + sizeof(LSA_REFERENCED_DOMAIN_LIST));
domain_data = (char*)(*domains)->Domains + sizeof(LSA_TRUST_INFORMATION)*count;
domain.Buffer = heap_alloc(domain_size_max*sizeof(WCHAR));
for (i = 0; i < count; i++)
{
LSA_UNICODE_STRING domain;
domain.Length = domain_size_max*sizeof(WCHAR);
domain.MaximumLength = domain_size_max*sizeof(WCHAR);
domain.Buffer = heap_alloc(domain.Length);
(*sids)[i].Use = SidTypeUnknown;
(*sids)[i].DomainIndex = -1;
......@@ -444,9 +443,8 @@ NTSTATUS WINAPI LsaLookupNames2( LSA_HANDLE policy, ULONG flags, ULONG count,
(*sids)[i].DomainIndex = lsa_reflist_add_domain(*domains, &domain, &domain_data);
}
}
heap_free(domain.Buffer);
}
heap_free(domain.Buffer);
if (mapped == count) return STATUS_SUCCESS;
if (mapped > 0 && mapped < count) return STATUS_SOME_NOT_MAPPED;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment