Lei Zhang : gdi32: CreateDIBitmap should check for SetDIBits failure.

Alexandre Julliard julliard at winehq.org
Mon Jul 21 08:52:07 CDT 2008


Module: wine
Branch: master
Commit: ce552d4451ffecbb3c61eeb3982541a56872bae3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ce552d4451ffecbb3c61eeb3982541a56872bae3

Author: Lei Zhang <thestig at google.com>
Date:   Fri Jul 18 15:28:44 2008 -0700

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) )
         {




More information about the wine-cvs mailing list