https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fe0415a4ba76bd59ba9ff1...
commit fe0415a4ba76bd59ba9ff1b0b4cd7e15ee100623 Author: George Bișoc george.bisoc@reactos.org AuthorDate: Sat Oct 23 09:58:50 2021 +0200 Commit: George Bișoc george.bisoc@reactos.org CommitDate: Sat Oct 23 09:58:50 2021 +0200
[NTDLL_APITEST] Free the allocated memory block when we're done
This fixes a memory leak where we allocate a buffer for token statistics with RtlAllocateHeap routine but we never free it afterwards. --- modules/rostests/apitests/ntdll/NtDuplicateToken.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/modules/rostests/apitests/ntdll/NtDuplicateToken.c b/modules/rostests/apitests/ntdll/NtDuplicateToken.c index fa03d3b8a80..fb357f58bb4 100644 --- a/modules/rostests/apitests/ntdll/NtDuplicateToken.c +++ b/modules/rostests/apitests/ntdll/NtDuplicateToken.c @@ -153,7 +153,11 @@ DuplicateTokenAsEffective(VOID) trace("Number of privileges of effective only token -- %lu\n", TokenStats->PrivilegeCount); trace("Number of groups of effective only token -- %lu\n", TokenStats->GroupCount);
- /* We finished our tests, close the handles now */ + /* + * We finished our tests, free the memory + * block and close the handles now. + */ + RtlFreeHeap(RtlGetProcessHeap(), 0, TokenStats); CloseHandle(TokenHandle), CloseHandle(DuplicatedTokenHandle); }