mirror of
https://github.com/reactos/reactos.git
synced 2025-06-10 12:24:48 +00:00
Fixed a wrong parameter for a call to ZwFreeVirtualMemory(). This fixes a page fault at address 0 (cr2 = 0).
Fixed the calculation of the maximum heap count in RtlInitializeHeapManager(). svn path=/trunk/; revision=2812
This commit is contained in:
parent
c75ecda469
commit
b17ab99f15
1 changed files with 11 additions and 4 deletions
|
@ -461,9 +461,10 @@ static void HEAP_MakeInUseBlockFree( SUBHEAP *subheap, ARENA_INUSE *pArena,
|
||||||
subheap->magic = 0;
|
subheap->magic = 0;
|
||||||
if (!(flags & HEAP_NO_VALLOC))
|
if (!(flags & HEAP_NO_VALLOC))
|
||||||
{
|
{
|
||||||
|
ULONG dummySize = 0;
|
||||||
ZwFreeVirtualMemory(NtCurrentProcess(),
|
ZwFreeVirtualMemory(NtCurrentProcess(),
|
||||||
(PVOID*)&subheap,
|
(PVOID*)&subheap,
|
||||||
0,
|
&dummySize,
|
||||||
MEM_RELEASE);
|
MEM_RELEASE);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -622,9 +623,10 @@ static SUBHEAP *HEAP_CreateSubHeap(PVOID BaseAddress,
|
||||||
{
|
{
|
||||||
if (!(flags & HEAP_NO_VALLOC))
|
if (!(flags & HEAP_NO_VALLOC))
|
||||||
{
|
{
|
||||||
|
ULONG dummySize = 0;
|
||||||
ZwFreeVirtualMemory(NtCurrentProcess(),
|
ZwFreeVirtualMemory(NtCurrentProcess(),
|
||||||
address,
|
address,
|
||||||
0,
|
&dummySize,
|
||||||
MEM_RELEASE);
|
MEM_RELEASE);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -940,11 +942,15 @@ static BOOL HEAP_IsRealArena(
|
||||||
+ sizeof(ARENA_INUSE)))
|
+ sizeof(ARENA_INUSE)))
|
||||||
{
|
{
|
||||||
if (quiet == NOISY)
|
if (quiet == NOISY)
|
||||||
|
{
|
||||||
ERR("Heap %08lx: block %08lx is not inside heap\n",
|
ERR("Heap %08lx: block %08lx is not inside heap\n",
|
||||||
(DWORD)heap, (DWORD)block );
|
(DWORD)heap, (DWORD)block );
|
||||||
|
}
|
||||||
else if (WARN_ON(heap))
|
else if (WARN_ON(heap))
|
||||||
|
{
|
||||||
WARN("Heap %08lx: block %08lx is not inside heap\n",
|
WARN("Heap %08lx: block %08lx is not inside heap\n",
|
||||||
(DWORD)heap, (DWORD)block );
|
(DWORD)heap, (DWORD)block );
|
||||||
|
}
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
} else
|
} else
|
||||||
ret = HEAP_ValidateInUseArena( subheap, (ARENA_INUSE *)block - 1, quiet );
|
ret = HEAP_ValidateInUseArena( subheap, (ARENA_INUSE *)block - 1, quiet );
|
||||||
|
@ -1064,9 +1070,10 @@ RtlDestroyHeap(HANDLE heap) /* [in] Handle of heap */
|
||||||
|
|
||||||
if (!(heapPtr->flags & HEAP_NO_VALLOC))
|
if (!(heapPtr->flags & HEAP_NO_VALLOC))
|
||||||
{
|
{
|
||||||
|
ULONG dummySize = 0;
|
||||||
ZwFreeVirtualMemory(NtCurrentProcess(),
|
ZwFreeVirtualMemory(NtCurrentProcess(),
|
||||||
(PVOID*)&subheap,
|
(PVOID*)&subheap,
|
||||||
0,
|
&dummySize,
|
||||||
MEM_RELEASE);
|
MEM_RELEASE);
|
||||||
}
|
}
|
||||||
subheap = next;
|
subheap = next;
|
||||||
|
@ -1557,7 +1564,7 @@ RtlInitializeHeapManager(VOID)
|
||||||
Peb = NtCurrentPeb();
|
Peb = NtCurrentPeb();
|
||||||
|
|
||||||
Peb->NumberOfHeaps = 0;
|
Peb->NumberOfHeaps = 0;
|
||||||
Peb->MaximumNumberOfHeaps = (PAGESIZE - sizeof(PPEB)) / sizeof(HANDLE);
|
Peb->MaximumNumberOfHeaps = (PAGESIZE - sizeof(PEB)) / sizeof(HANDLE);
|
||||||
Peb->ProcessHeaps = (PVOID)Peb + sizeof(PEB);
|
Peb->ProcessHeaps = (PVOID)Peb + sizeof(PEB);
|
||||||
|
|
||||||
RtlInitializeCriticalSection(&RtlpProcessHeapsListLock);
|
RtlInitializeCriticalSection(&RtlpProcessHeapsListLock);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue