mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
Never allocate 0 bytes. Fixes bug 1082.
svn path=/trunk/; revision=20010
This commit is contained in:
parent
188a82d7eb
commit
d224b2b02f
1 changed files with 6 additions and 2 deletions
|
@ -405,7 +405,11 @@ typedef struct _ScanLineListBlock {
|
||||||
static __inline int xmemcheck(ROSRGNDATA *reg, PRECT *rect, PRECT *firstrect ) {
|
static __inline int xmemcheck(ROSRGNDATA *reg, PRECT *rect, PRECT *firstrect ) {
|
||||||
if ( (reg->rdh.nCount+1)*sizeof( RECT ) >= reg->rdh.nRgnSize ) {
|
if ( (reg->rdh.nCount+1)*sizeof( RECT ) >= reg->rdh.nRgnSize ) {
|
||||||
PRECT temp;
|
PRECT temp;
|
||||||
temp = ExAllocatePoolWithTag( PagedPool, (2 * (reg->rdh.nRgnSize)), TAG_REGION);
|
DWORD NewSize = 2 * reg->rdh.nRgnSize;
|
||||||
|
if (NewSize < (reg->rdh.nCount + 1) * sizeof(RECT)) {
|
||||||
|
NewSize = (reg->rdh.nCount + 1) * sizeof(RECT);
|
||||||
|
}
|
||||||
|
temp = ExAllocatePoolWithTag( PagedPool, NewSize, TAG_REGION);
|
||||||
|
|
||||||
if (temp == 0)
|
if (temp == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -413,7 +417,7 @@ static __inline int xmemcheck(ROSRGNDATA *reg, PRECT *rect, PRECT *firstrect ) {
|
||||||
/* copy the rectangles */
|
/* copy the rectangles */
|
||||||
COPY_RECTS(temp, *firstrect, reg->rdh.nCount);
|
COPY_RECTS(temp, *firstrect, reg->rdh.nCount);
|
||||||
|
|
||||||
reg->rdh.nRgnSize *= 2;
|
reg->rdh.nRgnSize = NewSize;
|
||||||
if (*firstrect != ®->rdh.rcBound)
|
if (*firstrect != ®->rdh.rcBound)
|
||||||
ExFreePool( *firstrect );
|
ExFreePool( *firstrect );
|
||||||
*firstrect = temp;
|
*firstrect = temp;
|
||||||
|
|
Loading…
Reference in a new issue