Author: arty
Date: Mon Nov 19 02:59:48 2007
New Revision: 30567
URL:
http://svn.reactos.org/svn/reactos?rev=30567&view=rev
Log:
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.
Modified:
trunk/reactos/subsystems/win32/win32k/eng/mem.c
trunk/reactos/subsystems/win32/win32k/ntuser/message.c
trunk/reactos/subsystems/win32/win32k/objects/dc.c
Modified: trunk/reactos/subsystems/win32/win32k/eng/mem.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/en…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/eng/mem.c (original)
+++ trunk/reactos/subsystems/win32/win32k/eng/mem.c Mon Nov 19 02:59:48 2007
@@ -102,7 +102,7 @@
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);
}
/*
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/message.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/message.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/message.c Mon Nov 19 02:59:48 2007
@@ -887,7 +887,7 @@
if (! NT_SUCCESS(Status))
{
ZwFreeVirtualMemory(NtCurrentProcess(), (PVOID *) &UserMem,
- &Info.LParamSize, MEM_DECOMMIT);
+ &Info.LParamSize, MEM_RELEASE);
SetLastNtError(Status);
RETURN( (BOOL) -1);
}
Modified: trunk/reactos/subsystems/win32/win32k/objects/dc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dc.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dc.c Mon Nov 19 02:59:48 2007
@@ -2418,7 +2418,7 @@
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);