Alexandre Julliard : ntdll: Don' t try to decommit a heap past its initial commit size.
Alexandre Julliard
julliard at winehq.org
Thu Jun 25 08:13:58 CDT 2009
Module: wine
Branch: master
Commit: c68594a9417c98b2a3a8056b9ef8512822673cdb
URL: http://source.winehq.org/git/wine.git/?a=commit;h=c68594a9417c98b2a3a8056b9ef8512822673cdb
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Jun 25 12:11:14 2009 +0200
ntdll: Don't try to decommit a heap past its initial commit size.
---
dlls/ntdll/heap.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c
index 638cb3e..5466a54 100644
--- a/dlls/ntdll/heap.c
+++ b/dlls/ntdll/heap.c
@@ -125,6 +125,7 @@ typedef struct tagSUBHEAP
{
void *base; /* Base address of the sub-heap memory block */
SIZE_T size; /* Size of the whole sub-heap */
+ SIZE_T min_commit; /* Minimum committed size */
SIZE_T commitSize; /* Committed size of the sub-heap */
struct list entry; /* Entry in sub-heap list */
struct tagHEAP *heap; /* Main heap structure */
@@ -490,6 +491,7 @@ static inline BOOL HEAP_Decommit( SUBHEAP *subheap, void *ptr )
/* round to next block and add one full block */
size = ((size + COMMIT_MASK) & ~COMMIT_MASK) + COMMIT_MASK + 1;
+ size = max( size, subheap->min_commit );
if (size >= subheap->commitSize) return TRUE;
decommit_size = subheap->commitSize - size;
addr = (char *)subheap->base + size;
@@ -799,6 +801,7 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags,
subheap->base = address;
subheap->heap = heap;
subheap->size = totalSize;
+ subheap->min_commit = 0x10000;
subheap->commitSize = commitSize;
subheap->magic = SUBHEAP_MAGIC;
subheap->headerSize = ROUND_SIZE( sizeof(SUBHEAP) );
@@ -819,6 +822,7 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags,
subheap->base = address;
subheap->heap = heap;
subheap->size = totalSize;
+ subheap->min_commit = commitSize;
subheap->commitSize = commitSize;
subheap->magic = SUBHEAP_MAGIC;
subheap->headerSize = ROUND_SIZE( sizeof(HEAP) );
More information about the wine-cvs
mailing list