Vincent Povirk : gdiplus: Add error checking to GdipClonePen.

Alexandre Julliard julliard at winehq.org
Thu Aug 15 13:12:47 CDT 2013


Module: wine
Branch: master
Commit: dc047ecdaaee5e2b2dae6e665b51dc57764b2091
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=dc047ecdaaee5e2b2dae6e665b51dc57764b2091

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Wed Aug 14 16:34:25 2013 -0500

gdiplus: Add error checking to GdipClonePen.

---

 dlls/gdiplus/pen.c |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/dlls/gdiplus/pen.c b/dlls/gdiplus/pen.c
index a022cfb..80ede40 100644
--- a/dlls/gdiplus/pen.c
+++ b/dlls/gdiplus/pen.c
@@ -87,6 +87,8 @@ static GpPenType bt_to_pt(GpBrushType bt)
 
 GpStatus WINGDIPAPI GdipClonePen(GpPen *pen, GpPen **clonepen)
 {
+    GpStatus stat;
+
     TRACE("(%p, %p)\n", pen, clonepen);
 
     if(!pen || !clonepen)
@@ -97,9 +99,24 @@ GpStatus WINGDIPAPI GdipClonePen(GpPen *pen, GpPen **clonepen)
 
     **clonepen = *pen;
 
-    GdipCloneCustomLineCap(pen->customstart, &(*clonepen)->customstart);
-    GdipCloneCustomLineCap(pen->customend, &(*clonepen)->customend);
-    GdipCloneBrush(pen->brush, &(*clonepen)->brush);
+    (*clonepen)->customstart = NULL;
+    (*clonepen)->customend = NULL;
+    (*clonepen)->brush = NULL;
+
+    stat = GdipCloneBrush(pen->brush, &(*clonepen)->brush);
+
+    if (stat == Ok && pen->customstart)
+        stat = GdipCloneCustomLineCap(pen->customstart, &(*clonepen)->customstart);
+
+    if (stat == Ok && pen->customend)
+        stat = GdipCloneCustomLineCap(pen->customend, &(*clonepen)->customend);
+
+    if (stat != Ok)
+    {
+        GdipDeletePen(*clonepen);
+        *clonepen = NULL;
+        return stat;
+    }
 
     TRACE("<-- %p\n", *clonepen);
 




More information about the wine-cvs mailing list