[ros-diffs] [gschneider] 42856: - Handle failed memory allocation in CreateDIBitmap, check initialize option before allocating and copying
gschneider at svn.reactos.org
gschneider at svn.reactos.org
Sat Aug 22 18:56:29 CEST 2009
Author: gschneider
Date: Sat Aug 22 18:56:28 2009
New Revision: 42856
URL: http://svn.reactos.org/svn/reactos?rev=42856&view=rev
Log:
- Handle failed memory allocation in CreateDIBitmap, check initialize option before allocating and copying
Modified:
trunk/reactos/dll/win32/gdi32/objects/bitmap.c
Modified: trunk/reactos/dll/win32/gdi32/objects/bitmap.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/bitmap.c?rev=42856&r1=42855&r2=42856&view=diff
==============================================================================
--- trunk/reactos/dll/win32/gdi32/objects/bitmap.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdi32/objects/bitmap.c [iso-8859-1] Sat Aug 22 18:56:28 2009
@@ -501,11 +501,18 @@
hBmp = GetStockObject(DEFAULT_BITMAP);
else
{
- if ( Bits )
+ if ( Bits && Init == CBM_INIT )
{
pvSafeBits = RtlAllocateHeap(GetProcessHeap(), 0, cjBmpScanSize);
- if ( pvSafeBits )
+ if (pvSafeBits == NULL)
+ {
+ hBmp = NULL;
+ goto Exit;
+ }
+ else
+ {
RtlCopyMemory( pvSafeBits, Bits, cjBmpScanSize);
+ }
}
hBmp = NtGdiCreateDIBitmapInternal(hDC,
@@ -520,7 +527,7 @@
0,
0);
- if ( Bits )
+ if ( Bits && Init == CBM_INIT )
RtlFreeHeap(RtlGetProcessHeap(), 0, pvSafeBits);
}
Exit:
More information about the Ros-diffs
mailing list