mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
Fixed a bug in RtlDestroyHeap, that will cause a page fault, if more than one subheap exist.
svn path=/trunk/; revision=2820
This commit is contained in:
parent
bcde238ede
commit
224bb37961
1 changed files with 6 additions and 2 deletions
|
@ -1046,7 +1046,7 @@ RtlDestroyHeap(HANDLE heap) /* [in] Handle of heap */
|
||||||
{
|
{
|
||||||
HEAP *heapPtr = HEAP_GetPtr( heap );
|
HEAP *heapPtr = HEAP_GetPtr( heap );
|
||||||
SUBHEAP *subheap;
|
SUBHEAP *subheap;
|
||||||
ULONG i;
|
ULONG i, flags;
|
||||||
|
|
||||||
TRACE("%08x\n", heap );
|
TRACE("%08x\n", heap );
|
||||||
if (!heapPtr) return FALSE;
|
if (!heapPtr) return FALSE;
|
||||||
|
@ -1064,11 +1064,15 @@ RtlDestroyHeap(HANDLE heap) /* [in] Handle of heap */
|
||||||
|
|
||||||
RtlDeleteCriticalSection( &heapPtr->critSection );
|
RtlDeleteCriticalSection( &heapPtr->critSection );
|
||||||
subheap = &heapPtr->subheap;
|
subheap = &heapPtr->subheap;
|
||||||
|
// We must save the flags. The first subheap is located after
|
||||||
|
// the heap structure. If we release the first subheap,
|
||||||
|
// we release also the heap structure.
|
||||||
|
flags = heapPtr->flags;
|
||||||
while (subheap)
|
while (subheap)
|
||||||
{
|
{
|
||||||
SUBHEAP *next = subheap->next;
|
SUBHEAP *next = subheap->next;
|
||||||
|
|
||||||
if (!(heapPtr->flags & HEAP_NO_VALLOC))
|
if (!(flags & HEAP_NO_VALLOC))
|
||||||
{
|
{
|
||||||
ULONG dummySize = 0;
|
ULONG dummySize = 0;
|
||||||
ZwFreeVirtualMemory(NtCurrentProcess(),
|
ZwFreeVirtualMemory(NtCurrentProcess(),
|
||||||
|
|
Loading…
Reference in a new issue