Commit d45d54ef authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

win32u: Fix memory leak on error path in PATH_WidenPath (cppcheck).

parent cf7dd520
...@@ -1616,7 +1616,7 @@ BOOL WINAPI NtGdiFlattenPath( HDC hdc ) ...@@ -1616,7 +1616,7 @@ BOOL WINAPI NtGdiFlattenPath( HDC hdc )
static struct gdi_path *PATH_WidenPath(DC *dc) static struct gdi_path *PATH_WidenPath(DC *dc)
{ {
INT i, j, numStrokes, penWidth, penWidthIn, penWidthOut, size, penStyle; INT i, j, numStrokes, penWidth, penWidthIn, penWidthOut, size, penStyle;
struct gdi_path *flat_path, *pNewPath, **pStrokes = NULL, *pUpPath, *pDownPath; struct gdi_path *flat_path, *pNewPath, **pStrokes = NULL, **new_strokes, *pUpPath, *pDownPath;
EXTLOGPEN *elp; EXTLOGPEN *elp;
BYTE *type; BYTE *type;
DWORD obj_type, joint, endcap, penType; DWORD obj_type, joint, endcap, penType;
...@@ -1681,12 +1681,14 @@ static struct gdi_path *PATH_WidenPath(DC *dc) ...@@ -1681,12 +1681,14 @@ static struct gdi_path *PATH_WidenPath(DC *dc)
case PT_MOVETO: case PT_MOVETO:
numStrokes++; numStrokes++;
j = 0; j = 0;
pStrokes = realloc( pStrokes, numStrokes * sizeof(*pStrokes) ); new_strokes = realloc( pStrokes, numStrokes * sizeof(*pStrokes) );
if(!pStrokes) if (!new_strokes)
{ {
free_gdi_path(flat_path); free_gdi_path(flat_path);
free(pStrokes);
return NULL; return NULL;
} }
pStrokes = new_strokes;
pStrokes[numStrokes - 1] = alloc_gdi_path(0); pStrokes[numStrokes - 1] = alloc_gdi_path(0);
/* fall through */ /* fall through */
case PT_LINETO: case PT_LINETO:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment