mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-01 19:26:16 +00:00
When doing NtAllocateVirtualMemory, you need to MEM_RELEASE if you intend to
free the memory, otherwise you'll get stray address space hanging around. This was noticeable as a leak if you just left the command prompt sitting, because every DC allocated to blink the cursor kept address space that was never freed. svn path=/trunk/; revision=30567
This commit is contained in:
@@ -102,7 +102,7 @@ EngFreeUserMem(PVOID pv)
|
||||
PUSERMEMHEADER Header = ((PUSERMEMHEADER) pv) - 1;
|
||||
ULONG MemSize = sizeof(USERMEMHEADER) + Header->MemSize;
|
||||
|
||||
ZwFreeVirtualMemory(NtCurrentProcess(), (PVOID *) &Header, &MemSize, MEM_DECOMMIT);
|
||||
ZwFreeVirtualMemory(NtCurrentProcess(), (PVOID *) &Header, &MemSize, MEM_RELEASE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -887,7 +887,7 @@ NtUserPeekMessage(PNTUSERGETMESSAGEINFO UnsafeInfo,
|
||||
if (! NT_SUCCESS(Status))
|
||||
{
|
||||
ZwFreeVirtualMemory(NtCurrentProcess(), (PVOID *) &UserMem,
|
||||
&Info.LParamSize, MEM_DECOMMIT);
|
||||
&Info.LParamSize, MEM_RELEASE);
|
||||
SetLastNtError(Status);
|
||||
RETURN( (BOOL) -1);
|
||||
}
|
||||
|
||||
@@ -2418,7 +2418,7 @@ DC_FreeDcAttr(HDC DCToFree )
|
||||
NTSTATUS Status = ZwFreeVirtualMemory(Pid,
|
||||
&Entry->UserData,
|
||||
&MemSize,
|
||||
MEM_DECOMMIT);
|
||||
MEM_RELEASE);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("DC_FreeDC DC_ATTR 0x%x\n", Entry->UserData);
|
||||
|
||||
Reference in New Issue
Block a user