From 4ef8986a9acb407751084a3039bcb95bd00a92a4 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Fri, 13 Apr 2012 18:33:56 +0000 Subject: [PATCH] [WIN32K] Fix path reference leaks in PATH_add_outline Should fix failed assertion when closing google earth. thanks to r3ddr4g0n for providing the neccessary debug info. svn path=/trunk/; revision=56342 --- reactos/win32ss/gdi/ntgdi/path.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/reactos/win32ss/gdi/ntgdi/path.c b/reactos/win32ss/gdi/ntgdi/path.c index 9b169d54219..315b95e21e5 100644 --- a/reactos/win32ss/gdi/ntgdi/path.c +++ b/reactos/win32ss/gdi/ntgdi/path.c @@ -2005,10 +2005,12 @@ PATH_add_outline(PDC dc, INT x, INT y, TTPOLYGONHEADER *header, DWORD size) PPATH pPath; TTPOLYGONHEADER *start; POINT pt; + BOOL bResult = FALSE; start = header; pPath = PATH_LockPath(dc->dclevel.hPath); + if (!pPath) { return FALSE; } @@ -2020,7 +2022,7 @@ PATH_add_outline(PDC dc, INT x, INT y, TTPOLYGONHEADER *header, DWORD size) if (header->dwType != TT_POLYGON_TYPE) { DPRINT1("Unknown header type %d\n", header->dwType); - return FALSE; + goto cleanup; } pt.x = x + int_from_fixed(header->pfxStart.x); @@ -2055,7 +2057,7 @@ PATH_add_outline(PDC dc, INT x, INT y, TTPOLYGONHEADER *header, DWORD size) POINTFX ptfx; POINT *pts = ExAllocatePoolWithTag(PagedPool, (curve->cpfx + 1) * sizeof(POINT), TAG_PATH); - if (!pts) return FALSE; + if (!pts) goto cleanup; ptfx = *(POINTFX *)((char *)curve - sizeof(POINTFX)); @@ -2076,7 +2078,7 @@ PATH_add_outline(PDC dc, INT x, INT y, TTPOLYGONHEADER *header, DWORD size) default: DPRINT1("Unknown curve type %04x\n", curve->wType); - return FALSE; + goto cleanup; } curve = (TTPOLYCURVE *)&curve->apfx[curve->cpfx]; @@ -2084,9 +2086,12 @@ PATH_add_outline(PDC dc, INT x, INT y, TTPOLYGONHEADER *header, DWORD size) header = (TTPOLYGONHEADER *)((char *)header + header->cb); } + bResult = TRUE; + +cleanup: IntGdiCloseFigure( pPath ); PATH_UnlockPath( pPath ); - return TRUE; + return bResult; } /**********************************************************************