[NTGDI]
authorKamil Hornicek <kamil.hornicek@reactos.org>
Wed, 22 Feb 2017 10:26:40 +0000 (10:26 +0000)
committerKamil Hornicek <kamil.hornicek@reactos.org>
Wed, 22 Feb 2017 10:26:40 +0000 (10:26 +0000)
- 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
reactos/win32ss/gdi/ntgdi/drawing.c
reactos/win32ss/gdi/ntgdi/gdiobj.c
reactos/win32ss/gdi/ntgdi/path.c

index c60fadf..cb35adc 100644 (file)
@@ -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)
index 7dd8284..c3050de 100644 (file)
@@ -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))
index 37a1ec2..da7488c 100644 (file)
@@ -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];
index bd0f9c8..5a014a3 100644 (file)
@@ -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;