Module: wine Branch: stable Commit: 25137e1cc16da13656a3c1f1fa6163062a3459c1 URL: https://source.winehq.org/git/wine.git/?a=commit;h=25137e1cc16da13656a3c1f1f...
Author: Jiajin Cui cuijiajin@uniontech.com Date: Fri Jul 17 17:34:09 2020 +0800
gdiplus: Fix crash if failed to create bitmap.
Signed-off-by: Jiajin Cui cuijiajin@uniontech.com Signed-off-by: Esme Povirk esme@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org (cherry picked from commit f992bc77c87889c37cbd80aced707e6d1a537c8c) Signed-off-by: Michael Stefaniuc mstefani@winehq.org
---
dlls/gdiplus/graphics.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 2d7f4bdb80f..fa46e7cc4ce 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -432,6 +432,9 @@ static GpStatus alpha_blend_hdc_pixels(GpGraphics *graphics, INT dst_x, INT dst_ hbitmap = CreateDIBSection(hdc, (BITMAPINFO*)&bih, DIB_RGB_COLORS, (void**)&temp_bits, NULL, 0);
+ if(!hbitmap || !temp_bits) + goto done; + if ((GetDeviceCaps(graphics->hdc, TECHNOLOGY) == DT_RASPRINTER && GetDeviceCaps(graphics->hdc, SHADEBLENDCAPS) == SB_NONE) || fmt & PixelFormatPAlpha) @@ -443,9 +446,12 @@ static GpStatus alpha_blend_hdc_pixels(GpGraphics *graphics, INT dst_x, INT dst_ SelectObject(hdc, hbitmap); gdi_alpha_blend(graphics, dst_x, dst_y, src_width, src_height, hdc, 0, 0, src_width, src_height); - DeleteDC(hdc); + DeleteObject(hbitmap);
+done: + DeleteDC(hdc); + return Ok; }