@@ -1789,7 +1789,7 @@ PPATH FASTCALL
17891789IntGdiWidenPath (PPATH pPath , UINT penWidth , UINT penStyle , FLOAT eMiterLimit )
17901790{
17911791 INT i , j , numStrokes , numOldStrokes , penWidthIn , penWidthOut ;
1792- PPATH flat_path , pNewPath , * pStrokes = NULL , * pOldStrokes , pUpPath , pDownPath ;
1792+ PPATH flat_path , pNewPath = NULL , * pStrokes = NULL , * pOldStrokes , pUpPath , pDownPath ;
17931793 BYTE * type ;
17941794 DWORD joint , endcap ;
17951795 KFLOATING_SAVE fpsave ;
@@ -1819,11 +1819,7 @@ IntGdiWidenPath(PPATH pPath, UINT penWidth, UINT penStyle, FLOAT eMiterLimit)
18191819 ERR ("Expected PT_MOVETO %s, got path flag %c\n" ,
18201820 i == 0 ? "as first point" : "after PT_CLOSEFIGURE" ,
18211821 flat_path -> pFlags [i ]);
1822- if (pStrokes )
1823- ExFreePoolWithTag (pStrokes , TAG_PATH );
1824- PATH_UnlockPath (flat_path );
1825- PATH_Delete (flat_path -> BaseObject .hHmgr );
1826- return NULL ;
1822+ goto Exit ;
18271823 }
18281824 switch (flat_path -> pFlags [i ])
18291825 {
@@ -1844,18 +1840,14 @@ IntGdiWidenPath(PPATH pPath, UINT penWidth, UINT penStyle, FLOAT eMiterLimit)
18441840 if (!pStrokes )
18451841 {
18461842 ExFreePoolWithTag (pOldStrokes , TAG_PATH );
1847- PATH_UnlockPath (flat_path );
1848- PATH_Delete (flat_path -> BaseObject .hHmgr );
1849- return NULL ;
1843+ goto Exit ;
18501844 }
18511845 RtlCopyMemory (pStrokes , pOldStrokes , numOldStrokes * sizeof (PPATH ));
18521846 ExFreePoolWithTag (pOldStrokes , TAG_PATH ); // Free old pointer.
18531847 }
18541848 if (!pStrokes )
18551849 {
1856- PATH_UnlockPath (flat_path );
1857- PATH_Delete (flat_path -> BaseObject .hHmgr );
1858- return NULL ;
1850+ goto Exit ;
18591851 }
18601852 pStrokes [numStrokes - 1 ] = ExAllocatePoolWithTag (PagedPool , sizeof (PATH ), TAG_PATH );
18611853 if (!pStrokes [numStrokes - 1 ])
@@ -1876,15 +1868,16 @@ IntGdiWidenPath(PPATH pPath, UINT penWidth, UINT penStyle, FLOAT eMiterLimit)
18761868 break ;
18771869 default :
18781870 ERR ("Got path flag %c\n" , flat_path -> pFlags [i ]);
1879- if (pStrokes )
1880- ExFreePoolWithTag (pStrokes , TAG_PATH );
1881- PATH_UnlockPath (flat_path );
1882- PATH_Delete (flat_path -> BaseObject .hHmgr );
1883- return NULL ;
1871+ goto Exit ;
18841872 }
18851873 }
18861874
18871875 pNewPath = PATH_CreatePath ( flat_path -> numEntriesUsed );
1876+ if (pNewPath == NULL )
1877+ {
1878+ ERR ("PATH_CreatePath\n" );
1879+ goto Exit ;
1880+ }
18881881
18891882 KeSaveFloatingPointState (& fpsave );
18901883
@@ -2106,15 +2099,18 @@ IntGdiWidenPath(PPATH pPath, UINT penWidth, UINT penStyle, FLOAT eMiterLimit)
21062099 PATH_DestroyGdiPath (pDownPath );
21072100 ExFreePoolWithTag (pDownPath , TAG_PATH );
21082101 }
2109- if (pStrokes ) ExFreePoolWithTag (pStrokes , TAG_PATH );
21102102
2111- PATH_UnlockPath (flat_path );
2112- PATH_Delete (flat_path -> BaseObject .hHmgr );
21132103 pNewPath -> state = PATH_Closed ;
21142104 PATH_UnlockPath (pNewPath );
21152105
21162106 KeRestoreFloatingPointState (& fpsave );
21172107
2108+ Exit :
2109+ if (pStrokes ) ExFreePoolWithTag (pStrokes , TAG_PATH );
2110+ HPATH hpathToDelete = flat_path -> BaseObject .hHmgr ;
2111+ PATH_UnlockPath (flat_path );
2112+ PATH_Delete (hpathToDelete );
2113+
21182114 return pNewPath ;
21192115}
21202116
0 commit comments