Author: cgutman
Date: Sun Sep 7 17:28:19 2008
New Revision: 36043
URL:
http://svn.reactos.org/svn/reactos?rev=36043&view=rev
Log:
- Make sure memory allocation succeeded
Modified:
trunk/reactos/subsystems/win32/win32k/dib/dib16bpp.c
trunk/reactos/subsystems/win32/win32k/dib/dib32bpp.c
trunk/reactos/subsystems/win32/win32k/dib/dib8bpp.c
trunk/reactos/subsystems/win32/win32k/objects/dc.c
Modified: trunk/reactos/subsystems/win32/win32k/dib/dib16bpp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/di…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/dib/dib16bpp.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/dib/dib16bpp.c [iso-8859-1] Sun Sep 7 17:28:19
2008
@@ -626,6 +626,13 @@
ScanLineAhead = (PIXEL *)ExAllocatePool(PagedPool, (DestRect->right -
DestRect->left) * sizeof(PIXEL));
+
+ if (!ScanLine || !ScanLineAhead)
+ {
+ if (ScanLine) ExFreePool(ScanLine);
+ if (ScanLineAhead) ExFreePool(ScanLineAhead);
+ return FALSE;
+ }
DestY = DestRect->top;
SpanIndex = 0;
Modified: trunk/reactos/subsystems/win32/win32k/dib/dib32bpp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/di…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/dib/dib32bpp.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/dib/dib32bpp.c [iso-8859-1] Sun Sep 7 17:28:19
2008
@@ -402,6 +402,13 @@
ScanLine = (PIXEL*)ExAllocatePool(PagedPool, (DestRect->right - DestRect->left) *
sizeof(PIXEL));
ScanLineAhead = (PIXEL *)ExAllocatePool(PagedPool, (DestRect->right -
DestRect->left) * sizeof(PIXEL));
+ if (!ScanLine || !ScanLineAhead)
+ {
+ if (ScanLine) ExFreePool(ScanLine);
+ if (ScanLineAhead) ExFreePool(ScanLineAhead);
+ return FALSE;
+ }
+
DestY = DestRect->top;
SpanIndex = 0;
while (NumPixels-- > 0) {
Modified: trunk/reactos/subsystems/win32/win32k/dib/dib8bpp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/di…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/dib/dib8bpp.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/dib/dib8bpp.c [iso-8859-1] Sun Sep 7 17:28:19
2008
@@ -387,6 +387,13 @@
ScanLine = (PIXEL*)ExAllocatePool(PagedPool, (DestRect->right - DestRect->left) *
sizeof(PIXEL));
ScanLineAhead = (PIXEL *)ExAllocatePool(PagedPool, (DestRect->right -
DestRect->left) * sizeof(PIXEL));
+ if (!ScanLine || !ScanLineAhead)
+ {
+ if (ScanLine) ExFreePool(ScanLine);
+ if (ScanLineAhead) ExFreePool(ScanLineAhead);
+ return FALSE;
+ }
+
DestY = DestRect->top;
SpanIndex = 0;
while (NumPixels-- > 0) {
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 [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dc.c [iso-8859-1] Sun Sep 7 17:28:19
2008
@@ -558,8 +558,8 @@
if (PrimarySurface.pEDDgpl)
{
RtlZeroMemory( PrimarySurface.pEDDgpl ,sizeof(EDD_DIRECTDRAW_GLOBAL));
- }
- ret = TRUE;
+ ret = TRUE;
+ }
goto cleanup;
}
@@ -963,6 +963,11 @@
{ // This is a cheesy way to do this.
PDC dc = DC_LockDc ( hDC );
defaultDCstate = ExAllocatePoolWithTag(PagedPool, sizeof(DC), TAG_DC);
+ if (!defaultDCstate)
+ {
+ DC_UnlockDc( dc );
+ return NULL;
+ }
RtlZeroMemory(defaultDCstate, sizeof(DC));
IntGdiCopyToSaveState(dc, defaultDCstate);
DC_UnlockDc( dc );