http://bugs.winehq.org/show_bug.cgi?id=27991
Summary: LsaLookupNames2 implementation leads to leak of returned buffer data Product: Wine Version: 1.3.26 Platform: x86 OS/Version: Linux Status: NEW Severity: minor Priority: P2 Component: advapi32 AssignedTo: wine-bugs@winehq.org ReportedBy: bunglehead@gmail.com
Just in case I forget about this.
LsaLookupNames2() returns domains data in LSA_REFERENCED_DOMAIN_LIST structure, that contains pointer to domain data array. We currently allocate all of this separately - first LSA_REFERENCED_DOMAIN_LIST itself then a linked array, and finally setting a pointer from one to another.
This is wrong and leads to allocations that can't be freed with LsaFreeMemory(), what should be done is to incrementally calculate all components buffer sizes and then allocate a single buffer that holds everything at once. With properly adjusted pointers of course, that act as offsets in it.
After that all related leaks will be fixed.
P.S. simple testing shows that native does something like that, at least HeapSize() for domains pointer returns large number and array pointer points 12 bytes from the buffer first byte.