[PATCH] gdiplus: free the correct pointer (Coverity)

Marcus Meissner marcus at jet.franken.de
Wed Jan 1 12:25:59 CST 2014


the loop did offsets into the allocated memory, but
the free should point at the origin.

712649 Free of address-of expression
---
 dlls/gdiplus/graphicspath.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c
index 8508b9b..882bc48 100644
--- a/dlls/gdiplus/graphicspath.c
+++ b/dlls/gdiplus/graphicspath.c
@@ -868,7 +868,7 @@ static GpStatus format_string_callback(HDC dc,
     for (i = index; i < length; ++i)
     {
         GLYPHMETRICS gm;
-        TTPOLYGONHEADER *ph = NULL;
+        TTPOLYGONHEADER *ph = NULL, *origph;
         char *start;
         DWORD len, ofs = 0;
         len = GetGlyphOutlineW(dc, string[i], GGO_BEZIER, &gm, 0, NULL, &identity);
@@ -877,7 +877,7 @@ static GpStatus format_string_callback(HDC dc,
             status = GenericError;
             break;
         }
-        ph = GdipAlloc(len);
+        origph = ph = GdipAlloc(len);
         start = (char *)ph;
         if (!ph || !lengthen_path(path, len / sizeof(POINTFX)))
         {
@@ -931,7 +931,7 @@ static GpStatus format_string_callback(HDC dc,
         x += gm.gmCellIncX * args->scale;
         y += gm.gmCellIncY * args->scale;
 
-        GdipFree(ph);
+        GdipFree(origph);
         if (status != Ok)
             break;
     }
-- 
1.7.10.4




More information about the wine-patches mailing list