mirror of
https://github.com/reactos/reactos.git
synced 2024-10-15 13:45:58 +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:
parent
4ba2b63f3b
commit
74c80e3705
|
@ -102,7 +102,7 @@ EngFreeUserMem(PVOID pv)
|
||||||
PUSERMEMHEADER Header = ((PUSERMEMHEADER) pv) - 1;
|
PUSERMEMHEADER Header = ((PUSERMEMHEADER) pv) - 1;
|
||||||
ULONG MemSize = sizeof(USERMEMHEADER) + Header->MemSize;
|
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))
|
if (! NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ZwFreeVirtualMemory(NtCurrentProcess(), (PVOID *) &UserMem,
|
ZwFreeVirtualMemory(NtCurrentProcess(), (PVOID *) &UserMem,
|
||||||
&Info.LParamSize, MEM_DECOMMIT);
|
&Info.LParamSize, MEM_RELEASE);
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
RETURN( (BOOL) -1);
|
RETURN( (BOOL) -1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2418,7 +2418,7 @@ DC_FreeDcAttr(HDC DCToFree )
|
||||||
NTSTATUS Status = ZwFreeVirtualMemory(Pid,
|
NTSTATUS Status = ZwFreeVirtualMemory(Pid,
|
||||||
&Entry->UserData,
|
&Entry->UserData,
|
||||||
&MemSize,
|
&MemSize,
|
||||||
MEM_DECOMMIT);
|
MEM_RELEASE);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("DC_FreeDC DC_ATTR 0x%x\n", Entry->UserData);
|
DPRINT("DC_FreeDC DC_ATTR 0x%x\n", Entry->UserData);
|
||||||
|
|
Loading…
Reference in a new issue