mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-03 04:13:31 +00:00
- Handle failed memory allocation in CreateDIBitmap, check initialize option before allocating and copying
svn path=/trunk/; revision=42856
This commit is contained in:
@@ -501,11 +501,18 @@ CreateDIBitmap( HDC hDC,
|
||||
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 @@ CreateDIBitmap( HDC hDC,
|
||||
0,
|
||||
0);
|
||||
|
||||
if ( Bits )
|
||||
if ( Bits && Init == CBM_INIT )
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, pvSafeBits);
|
||||
}
|
||||
Exit:
|
||||
|
||||
Reference in New Issue
Block a user