[PATCH v2 1/3] gdiplus: Fix a memory leak.

Zhiyi Zhang zzhang at codeweavers.com
Mon Jun 18 09:00:09 CDT 2018


bmp is leaked if fail to create hdc.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 dlls/gdiplus/graphics.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 76aabe74bf..894e879233 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -1069,7 +1069,11 @@ static void brush_fill_path(GpGraphics *graphics, GpBrush* brush)
             {
                 HDC hdc = CreateCompatibleDC(NULL);
 
-                if (!hdc) break;
+                if (!hdc)
+                {
+                    DeleteObject(bmp);
+                    break;
+                }
 
                 SelectObject(hdc, bmp);
                 gdi_alpha_blend(graphics, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
-- 
2.17.1





More information about the wine-devel mailing list