[7/9] gdiplus: better error checking in GdipBitmapLockBits
Evan Stade
estade at gmail.com
Thu Aug 9 20:25:27 CDT 2007
Hi,
changelog:
*delay return of error value until after cleaning up bitmap/dc mess
dlls/gdiplus/image.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
--
Evan Stade
-------------- next part --------------
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(G
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;
--
1.4.1
More information about the wine-patches
mailing list