From 4c93615823eef2ad027beca9430209a5a6a15a5d Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Fri, 18 Jul 2008 15:28:44 -0700 Subject: [PATCH 2/2] gdi32: CreateDIBitmap should check for SetDIBits failure. --- dlls/gdi32/dib.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c index 677cda5..440857d 100644 --- a/dlls/gdi32/dib.c +++ b/dlls/gdi32/dib.c @@ -1118,7 +1118,14 @@ HBITMAP WINAPI CreateDIBitmap( HDC hdc, const BITMAPINFOHEADER *header, if (handle) { - if (init == CBM_INIT) SetDIBits( hdc, handle, 0, height, bits, data, coloruse ); + if (init == CBM_INIT) + { + if (SetDIBits( hdc, handle, 0, height, bits, data, coloruse ) == 0) + { + DeleteObject( handle ); + handle = 0; + } + } else if (hdc && ((dc = get_dc_ptr( hdc )) != NULL) ) { -- 1.5.4.5