GDI+: fixes to GdipCreatePen1 [try2]

Evan Stade estade at gmail.com
Tue Jun 12 20:43:28 CDT 2007


Hi,

The last time I sent this patch it had a typo in it.

Changelog:
*fix memory leak
*fix erroneous error checking

 dlls/gdiplus/pen.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

-Evan Stade
-------------- next part --------------
diff --git a/dlls/gdiplus/pen.c b/dlls/gdiplus/pen.c
index 9354646..c0a683c 100644
--- a/dlls/gdiplus/pen.c
+++ b/dlls/gdiplus/pen.c
@@ -33,8 +33,12 @@ GpStatus WINGDIPAPI GdipCreatePen1(ARGB 
     LOGBRUSH lb;
     GpPen *gp_pen;
 
+    if(!pen)
+        return InvalidParameter;
+
     gp_pen = (GpPen*) GdipAlloc(sizeof(GpPen));
-    if(!pen)    return OutOfMemory;
+    if(!gp_pen) 
+        return OutOfMemory;
 
     gp_pen->style = GP_DEFAULT_PENSTYLE;
     gp_pen->color = ARGB2COLORREF(color);
@@ -51,12 +55,10 @@ GpStatus WINGDIPAPI GdipCreatePen1(ARGB 
             0, NULL);
     } else {
         FIXME("UnitWorld, UnitPixel only supported units");
+        GdipFree(gp_pen);
         return NotImplemented;
     }
 
-    if(!gp_pen)
-        return GenericError;
-
     *pen = gp_pen;
 
     return Ok;
-- 
1.4.1


More information about the wine-patches mailing list