From 53fdca886e137eec194ceeeba5493ce8098db540 Mon Sep 17 00:00:00 2001 From: Kamil Hornicek Date: Wed, 22 Feb 2017 10:26:40 +0000 Subject: [PATCH] [NTGDI] - Consider the return value from IntFillArc in IntArc. CID 1237076 - Remove an useless check in ENTRY_ReferenceEntryByHandle CID 731587 - Prevent an unlikely memory leak in PATH_WidenPath. CID 716634 - Minor cleanup. svn path=/trunk/; revision=73878 --- reactos/win32ss/gdi/ntgdi/arc.c | 21 ++++++++++++--------- reactos/win32ss/gdi/ntgdi/drawing.c | 8 -------- reactos/win32ss/gdi/ntgdi/gdiobj.c | 1 - reactos/win32ss/gdi/ntgdi/path.c | 4 ++++ 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/reactos/win32ss/gdi/ntgdi/arc.c b/reactos/win32ss/gdi/ntgdi/arc.c index c60fadfd5da..cb35adc9f79 100644 --- a/reactos/win32ss/gdi/ntgdi/arc.c +++ b/reactos/win32ss/gdi/ntgdi/arc.c @@ -143,15 +143,18 @@ IntArc( DC *dc, arctype); } - ret = IntDrawArc( dc, - RectBounds.left, - RectBounds.top, - abs(RectBounds.right-RectBounds.left), // Width - abs(RectBounds.bottom-RectBounds.top), // Height - AngleStart, - AngleEnd, - arctype, - pbrPen); + if(ret) + { + ret = IntDrawArc( dc, + RectBounds.left, + RectBounds.top, + abs(RectBounds.right-RectBounds.left), // Width + abs(RectBounds.bottom-RectBounds.top), // Height + AngleStart, + AngleEnd, + arctype, + pbrPen); + } psurf = dc->dclevel.pSurface; if (NULL == psurf) diff --git a/reactos/win32ss/gdi/ntgdi/drawing.c b/reactos/win32ss/gdi/ntgdi/drawing.c index 7dd82843053..c3050dee11b 100644 --- a/reactos/win32ss/gdi/ntgdi/drawing.c +++ b/reactos/win32ss/gdi/ntgdi/drawing.c @@ -162,8 +162,6 @@ app_draw_ellipse(DC *g, Rect r, PBRUSH pbrush) Rect r1, r2; int result = 1; -// START_DEBUG(); - if ((r.width <= 2) || (r.height <= 2)) return app_fill_rect(g, r, pbrush, TRUE); @@ -636,8 +634,6 @@ app_fill_ellipse(DC *g, Rect r, PBRUSH pbrush) Rect r1, r2; int result = 1; -// START_DEBUG(); - if ((r.width <= 2) || (r.height <= 2)) return app_fill_rect(g, r, pbrush, FALSE); @@ -810,8 +806,6 @@ app_fill_arc(DC *g, Rect r, int start_angle, int end_angle, PBRUSH pbrush, BOOL /* Line descriptions */ POINT p0, p1, p2; -// START_DEBUG(); - /* If angles differ by 360 degrees or more, close the shape */ if ((start_angle + 360 <= end_angle) || (start_angle - 360 >= end_angle)) @@ -1010,8 +1004,6 @@ int app_draw_arc(DC *g, Rect r, int start_angle, int end_angle, PBRUSH pbrushPen /* Line descriptions */ POINT p0, p1, p2; -// START_DEBUG(); - /* If angles differ by 360 degrees or more, close the shape */ if ((start_angle + 360 <= end_angle) || (start_angle - 360 >= end_angle)) diff --git a/reactos/win32ss/gdi/ntgdi/gdiobj.c b/reactos/win32ss/gdi/ntgdi/gdiobj.c index 37a1ec2263b..da7488c16ca 100644 --- a/reactos/win32ss/gdi/ntgdi/gdiobj.c +++ b/reactos/win32ss/gdi/ntgdi/gdiobj.c @@ -480,7 +480,6 @@ ENTRY_ReferenceEntryByHandle(HGDIOBJ hobj, FLONG fl) /* Get the handle index and check if its too big */ ulIndex = GDI_HANDLE_GET_INDEX(hobj); - if (ulIndex >= GDI_HANDLE_COUNT) return NULL; /* Get pointer to the entry */ pentry = &gpentHmgr[ulIndex]; diff --git a/reactos/win32ss/gdi/ntgdi/path.c b/reactos/win32ss/gdi/ntgdi/path.c index bd0f9c80fa6..5a014a3e030 100644 --- a/reactos/win32ss/gdi/ntgdi/path.c +++ b/reactos/win32ss/gdi/ntgdi/path.c @@ -1813,6 +1813,8 @@ PATH_WidenPath(DC *dc) DPRINT1("Expected PT_MOVETO %s, got path flag %c\n", i == 0 ? "as first point" : "after PT_CLOSEFIGURE", flat_path->pFlags[i]); + if (pStrokes) + ExFreePoolWithTag(pStrokes, TAG_PATH); PATH_UnlockPath(flat_path); PATH_Delete(flat_path->BaseObject.hHmgr); return FALSE; @@ -1867,6 +1869,8 @@ PATH_WidenPath(DC *dc) break; default: DPRINT1("Got path flag %c\n", flat_path->pFlags[i]); + if (pStrokes) + ExFreePoolWithTag(pStrokes, TAG_PATH); PATH_UnlockPath(flat_path); PATH_Delete(flat_path->BaseObject.hHmgr); return FALSE;