gdiplus: fix erroneous pen error checking

Evan Stade estade at gmail.com
Fri Jun 22 21:24:50 CDT 2007


Hi,

This is a resend, I don't know why the other one was rejected.  Anyway
this fixes a coverity error.

Changelog:
*fix erroneous GDI+ pen error checking

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

-- 
Evan Stade
-------------- next part --------------
diff --git a/dlls/gdiplus/pen.c b/dlls/gdiplus/pen.c
index d0355db..9ee72d9 100644
--- a/dlls/gdiplus/pen.c
+++ b/dlls/gdiplus/pen.c
@@ -33,8 +33,11 @@ GpStatus WINGDIPAPI GdipCreatePen1(ARGB 
     LOGBRUSH lb;
     GpPen *gp_pen;
 
+    if(!pen)
+        return InvalidParameter;
+
     gp_pen = 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 +54,10 @@ GpStatus WINGDIPAPI GdipCreatePen1(ARGB 
             0, NULL);
     } else {
         FIXME("UnitWorld, UnitPixel only supported units\n");
+        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