[ros-diffs] [tkreuzer] 33856: - fix mem leak when failing to create an extpen with penstyles - rename a tag, change a tag, remove unused tag

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Wed Jun 4 18:15:24 CEST 2008


Author: tkreuzer
Date: Wed Jun  4 11:15:24 2008
New Revision: 33856

URL: http://svn.reactos.org/svn/reactos?rev=33856&view=rev
Log:
- fix mem leak when failing to create an extpen with penstyles
- rename a tag, change a tag, remove unused tag

Modified:
    trunk/reactos/subsystems/win32/win32k/include/tags.h
    trunk/reactos/subsystems/win32/win32k/objects/pen.c

Modified: trunk/reactos/subsystems/win32/win32k/include/tags.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/tags.h?rev=33856&r1=33855&r2=33856&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/tags.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/tags.h [iso-8859-1] Wed Jun  4 11:15:24 2008
@@ -62,7 +62,6 @@
 #define TAG_COORD       TAG('C', 'O', 'R', 'D') /* coords */
 #define TAG_GDIDEV      TAG('G', 'd', 'e', 'v') /* gdi dev support*/
 #define TAG_GDIPDEV     TAG('G', 'D', 'e', 'v') /* gdi PDev */
-#define TAG_GDIOBJ      TAG('G', 'D', 'I', 'O') /* gdi obj */
 #define TAG_GDIHNDTBLE  TAG('G', 'D', 'I', 'H') /* gdi handle table */
 #define TAG_GDIICM      TAG('G', 'i', 'c', 'm') /* gdi Icm */
 #define TAG_DIB         TAG('D', 'I', 'B', ' ') /* dib */
@@ -71,13 +70,13 @@
 #define TAG_PALETTEMAP  TAG('P', 'A', 'L', 'M') /* palette mapping */
 #define TAG_PRINT       TAG('P', 'R', 'N', 'T') /* print */
 #define TAG_GDITEXT     TAG('T', 'X', 'T', 'O') /* text */
-#define TAG_EXTPEN      TAG('X', 'P', 'E', 'N') /* extpen */
+#define TAG_PENSTYLES   TAG('G', 's', 't', 'y') /* pen styles */
 
 /* Eng objects */
 #define TAG_CLIPOBJ     TAG('C', 'L', 'P', 'O') /* clip object */
 #define TAG_DRIVEROBJ   TAG('D', 'R', 'V', 'O') /* driver object */
 #define TAG_FONT        TAG('F', 'N', 'T', 'E') /* font entry */
-#define TAG_FONTOBJ     TAG('F', 'N', 'T', 'O') /* font object */
+#define TAG_FONTOBJ     TAG('G', 'f', 'n', 't') /* font object */
 #define TAG_WNDOBJ      TAG('W', 'N', 'D', 'O') /* window object */
 #define TAG_XLATEOBJ    TAG('X', 'L', 'A', 'O') /* xlate object */
 #define TAG_BITMAPOBJ   TAG('B', 'M', 'P', 'O') /* bitmap object */

Modified: trunk/reactos/subsystems/win32/win32k/objects/pen.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/pen.c?rev=33856&r1=33855&r2=33856&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/pen.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/pen.c [iso-8859-1] Wed Jun  4 11:15:24 2008
@@ -301,7 +301,7 @@
 
    if (dwStyleCount > 0)
    {
-      pSafeStyle = ExAllocatePoolWithTag(NonPagedPool, dwStyleCount * sizeof(DWORD), TAG_EXTPEN);
+      pSafeStyle = ExAllocatePoolWithTag(NonPagedPool, dwStyleCount * sizeof(DWORD), TAG_PENSTYLES);
       if (!pSafeStyle)
       {
          SetLastNtError(ERROR_NOT_ENOUGH_MEMORY);
@@ -338,7 +338,12 @@
                              cjDIB,
                              bOldStylePen,
                              hBrush);
-// BRUSH_Cleanup takes care of pSafeStyle
+
+   if (!hPen && pSafeStyle)
+   {
+      ExFreePool(pSafeStyle);
+   }
+// BRUSH_Cleanup takes care of pSafeStyle when deleteing the pen
    return hPen;
 }
 



More information about the Ros-diffs mailing list