[PATCH] gdiplus: Fix memory leak in format_string_callback error path.

Alex Henrie alexhenrie24 at gmail.com
Fri Dec 23 02:18:42 CST 2016


Coverity #713470, "Variable origph going out of scope leaks the
storage it points to."

Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
 dlls/gdiplus/graphicspath.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c
index b6ec88d0cc..8b3f502afe 100644
--- a/dlls/gdiplus/graphicspath.c
+++ b/dlls/gdiplus/graphicspath.c
@@ -879,11 +879,17 @@ static GpStatus format_string_callback(HDC dc,
         }
         origph = ph = heap_alloc_zero(len);
         start = (char *)ph;
-        if (!ph || !lengthen_path(path, len / sizeof(POINTFX)))
+        if (!ph)
         {
             status = OutOfMemory;
             break;
         }
+        if (!lengthen_path(path, len / sizeof(POINTFX)))
+        {
+            heap_free(ph);
+            status = OutOfMemory;
+            break;
+        }
         GetGlyphOutlineW(dc, string[i], GGO_BEZIER, &gm, len, start, &identity);
 
         ofs = 0;
-- 
2.11.0




More information about the wine-patches mailing list