Evan Stade : gdiplus: Better error checking in GdipBitmapLockBits.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Aug 10 07:31:19 CDT 2007
Module: wine
Branch: master
Commit: ff752456e123ded9d77a4654b7889709638a7aaa
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ff752456e123ded9d77a4654b7889709638a7aaa
Author: Evan Stade <estade at gmail.com>
Date: Thu Aug 9 18:25:27 2007 -0700
gdiplus: Better error checking in GdipBitmapLockBits.
---
dlls/gdiplus/image.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c
index a6cf671..633b225 100644
--- a/dlls/gdiplus/image.c
+++ b/dlls/gdiplus/image.c
@@ -142,16 +142,20 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
stride = (stride + 3) & ~3;
buff = GdipAlloc(stride * abs_height);
- if(!buff) return OutOfMemory;
bmi.bmiHeader.biBitCount = bitspp;
- GetDIBits(hdc, (HBITMAP)hbm, 0, abs_height, buff, &bmi, DIB_RGB_COLORS);
+
+ if(buff)
+ GetDIBits(hdc, (HBITMAP)hbm, 0, abs_height, buff, &bmi, DIB_RGB_COLORS);
if(!bm_is_selected){
SelectObject(hdc, old);
DeleteDC(hdc);
}
+ if(!buff)
+ return OutOfMemory;
+
lockeddata->Width = rect->Width;
lockeddata->Height = rect->Height;
lockeddata->PixelFormat = format;
More information about the wine-cvs
mailing list