diff --git a/reactos/subsystems/win32/win32k/dib/dib16bpp.c b/reactos/subsystems/win32/win32k/dib/dib16bpp.c index d3a5f27a67d..04285364bb7 100644 --- a/reactos/subsystems/win32/win32k/dib/dib16bpp.c +++ b/reactos/subsystems/win32/win32k/dib/dib16bpp.c @@ -626,6 +626,13 @@ BOOLEAN ScaleRectAvg16(SURFOBJ *DestSurf, SURFOBJ *SourceSurf, 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; diff --git a/reactos/subsystems/win32/win32k/dib/dib32bpp.c b/reactos/subsystems/win32/win32k/dib/dib32bpp.c index 6c413e2a026..d7bd9094819 100644 --- a/reactos/subsystems/win32/win32k/dib/dib32bpp.c +++ b/reactos/subsystems/win32/win32k/dib/dib32bpp.c @@ -402,6 +402,13 @@ BOOLEAN ScaleRectAvg32(SURFOBJ *DestSurf, SURFOBJ *SourceSurf, 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) { diff --git a/reactos/subsystems/win32/win32k/dib/dib8bpp.c b/reactos/subsystems/win32/win32k/dib/dib8bpp.c index 8d22d178c18..2a79bff26f9 100644 --- a/reactos/subsystems/win32/win32k/dib/dib8bpp.c +++ b/reactos/subsystems/win32/win32k/dib/dib8bpp.c @@ -387,6 +387,13 @@ BOOLEAN ScaleRectAvg8(SURFOBJ *DestSurf, SURFOBJ *SourceSurf, 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) { diff --git a/reactos/subsystems/win32/win32k/objects/dc.c b/reactos/subsystems/win32/win32k/objects/dc.c index b07294b9dfb..10f144cc011 100644 --- a/reactos/subsystems/win32/win32k/objects/dc.c +++ b/reactos/subsystems/win32/win32k/objects/dc.c @@ -558,8 +558,8 @@ IntPrepareDriver() if (PrimarySurface.pEDDgpl) { RtlZeroMemory( PrimarySurface.pEDDgpl ,sizeof(EDD_DIRECTDRAW_GLOBAL)); + ret = TRUE; } - ret = TRUE; goto cleanup; } @@ -963,6 +963,11 @@ IntGdiCreateDisplayDC(HDEV hDev, ULONG DcType, BOOL EmptyDC) { // 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 );