Patch by Daniel Zimmerman : Fix a lot of missing ExFreePoolWithTag. See bug 3848.
authorJames Tabor <james.tabor@reactos.org>
Tue, 4 Nov 2008 23:49:07 +0000 (23:49 +0000)
committerJames Tabor <james.tabor@reactos.org>
Tue, 4 Nov 2008 23:49:07 +0000 (23:49 +0000)
svn path=/trunk/; revision=37194

20 files changed:
reactos/subsystems/win32/win32k/eng/clip.c
reactos/subsystems/win32/win32k/misc/driver.c
reactos/subsystems/win32/win32k/ntuser/event.c
reactos/subsystems/win32/win32k/ntuser/hook.c
reactos/subsystems/win32/win32k/ntuser/input.c
reactos/subsystems/win32/win32k/ntuser/keyboard.c
reactos/subsystems/win32/win32k/ntuser/menu.c
reactos/subsystems/win32/win32k/ntuser/message.c
reactos/subsystems/win32/win32k/ntuser/misc.c
reactos/subsystems/win32/win32k/ntuser/sysparams.c
reactos/subsystems/win32/win32k/objects/bitmaps.c
reactos/subsystems/win32/win32k/objects/dibobj.c
reactos/subsystems/win32/win32k/objects/fillshap.c
reactos/subsystems/win32/win32k/objects/freetype.c
reactos/subsystems/win32/win32k/objects/line.c
reactos/subsystems/win32/win32k/objects/palobj.c
reactos/subsystems/win32/win32k/objects/path.c
reactos/subsystems/win32/win32k/objects/print.c
reactos/subsystems/win32/win32k/objects/region.c
reactos/subsystems/win32/win32k/objects/text.c

index bd0cdde..1fa7dac 100644 (file)
@@ -425,7 +425,6 @@ ClipobjToSpans(
                 (*Spans)[i].Width = Boundary->right - Boundary->left;
             }
         }
-
       return TRUE;
     }
 
@@ -447,7 +446,7 @@ ClipobjToSpans(
             {
                 if (NULL != *Spans)
                 {
-                    ExFreePool(*Spans);
+                    ExFreePoolWithTag(*Spans, TAG_CLIP);
                     *Spans = NULL;
                 }
                 *Count = 0;
@@ -461,7 +460,7 @@ ClipobjToSpans(
                 {
                     *dest++ = *src++;
                 }
-                ExFreePool(*Spans);
+                ExFreePoolWithTag(*Spans, TAG_CLIP);
             }
             *Spans = NewSpans;
         }
index 197142a..01c9c68 100644 (file)
@@ -41,12 +41,19 @@ typedef struct _GRAPHICS_DRIVER
 } GRAPHICS_DRIVER, *PGRAPHICS_DRIVER;
 
 static PGRAPHICS_DRIVER  DriverList;
-static PGRAPHICS_DRIVER  GenericDriver = 0;
+static PGRAPHICS_DRIVER  GenericDriver = NULL;
 
 BOOL DRIVER_RegisterDriver(LPCWSTR  Name, PGD_ENABLEDRIVER  EnableDriver)
 {
-  PGRAPHICS_DRIVER  Driver = ExAllocatePoolWithTag(PagedPool, sizeof(*Driver), TAG_DRIVER);
+  PGRAPHICS_DRIVER  Driver;
+  
   DPRINT( "DRIVER_RegisterDriver( Name: %S )\n", Name );
+  
+  if (GenericDriver != NULL)
+  {
+     return FALSE;
+  }
+  Driver = ExAllocatePoolWithTag(PagedPool, sizeof(*Driver), TAG_DRIVER);
   if (!Driver)  return  FALSE;
   Driver->ReferenceCount = 0;
   Driver->EnableDriver = EnableDriver;
@@ -58,7 +65,7 @@ BOOL DRIVER_RegisterDriver(LPCWSTR  Name, PGD_ENABLEDRIVER  EnableDriver)
     if (Driver->Name == NULL)
     {
         DPRINT1("Out of memory\n");
-        ExFreePool(Driver);
+        ExFreePoolWithTag(Driver, TAG_DRIVER);
         return  FALSE;
     }
 
@@ -68,12 +75,6 @@ BOOL DRIVER_RegisterDriver(LPCWSTR  Name, PGD_ENABLEDRIVER  EnableDriver)
     return  TRUE;
   }
 
-  if (GenericDriver != NULL)
-  {
-    ExFreePool(Driver);
-    return  FALSE;
-  }
-
   GenericDriver = Driver;
   return  TRUE;
 }
@@ -156,7 +157,7 @@ PGD_ENABLEDRIVER DRIVER_FindDDIDriver(LPCWSTR Name)
   ExistingDriver = DRIVER_FindExistingDDIDriver(FullName);
   if (ExistingDriver)
   {
-    ExFreePool(FullName);
+    ExFreePoolWithTag(FullName, TAG_DRIVER);
     return ExistingDriver;
   }
 
@@ -172,7 +173,7 @@ PGD_ENABLEDRIVER DRIVER_FindDDIDriver(LPCWSTR Name)
 
   DRIVER_RegisterDriver( L"DISPLAY", GdiDriverInfo.EntryPoint);
   DRIVER_RegisterDriver( FullName, GdiDriverInfo.EntryPoint);
-  ExFreePool(FullName);
+  ExFreePoolWithTag(FullName, TAG_DRIVER);
   return (PGD_ENABLEDRIVER)GdiDriverInfo.EntryPoint;
 }
 
index 20a9b97..bfad44e 100644 (file)
@@ -263,6 +263,11 @@ NtUserSetWinEventHook(
    if ( !GlobalEvents )
    {
       GlobalEvents = ExAllocatePoolWithTag(PagedPool, sizeof(EVENTTABLE), TAG_HOOK);
+      if (GlobalEvents == NULL)
+      {
+         SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
+         goto SetEventExit;
+      }
       GlobalEvents->Counts = 0;      
       InitializeListHead(&GlobalEvents->Events);
    }
@@ -348,7 +353,7 @@ NtUserSetWinEventHook(
 
          if (! NT_SUCCESS(Status))
          {
-            ExFreePool(pEH->ModuleName.Buffer);
+            ExFreePoolWithTag(pEH->ModuleName.Buffer, TAG_HOOK);
             UserDereferenceObject(pEH);
             IntRemoveEvent(pEH);
             SetLastNtError(Status);
index f573d2c..4fe0b49 100644 (file)
@@ -553,7 +553,7 @@ IntCallDebugHook(
 
    if (HooklParam) Debug.lParam = (LPARAM)HooklParam;
    lResult = co_HOOK_CallHookNext(Hook, Code, wParam, (LPARAM)&Debug);
-   if (HooklParam) ExFreePool(HooklParam);
+   if (HooklParam) ExFreePoolWithTag(HooklParam, TAG_HOOK);
    return lResult;
 }
 
@@ -1131,7 +1131,7 @@ NtUserSetWindowsHookEx(
                                 ModuleName.MaximumLength);
       if (! NT_SUCCESS(Status))
       {
-         ExFreePool(Hook->ModuleName.Buffer);
+         ExFreePoolWithTag(Hook->ModuleName.Buffer, TAG_HOOK);
          UserDereferenceObject(Hook);
          IntRemoveHook(Hook, WinStaObj, FALSE);
          if (NULL != Thread)
index 1d2163c..e13ddf4 100644 (file)
@@ -366,7 +366,7 @@ IntKeyboardGetIndicatorTrans(HANDLE KeyboardDeviceHandle,
       if (Status != STATUS_BUFFER_TOO_SMALL)
          break;
 
-      ExFreePool(Ret);
+      ExFreePoolWithTag(Ret, TAG_KEYBOARD);
 
       Size += sizeof(KEYBOARD_INDICATOR_TRANSLATION);
 
@@ -380,7 +380,7 @@ IntKeyboardGetIndicatorTrans(HANDLE KeyboardDeviceHandle,
 
    if (Status != STATUS_SUCCESS)
    {
-      ExFreePool(Ret);
+      ExFreePoolWithTag(Ret, TAG_KEYBOARD);
       return Status;
    }
 
index 1e1bad4..6684996 100644 (file)
@@ -737,7 +737,7 @@ NtUserToUnicodeEx(
                             pti ? pti->KeyboardLayout->KBTables : 0 );
 
       MmCopyToCaller(pwszBuff,OutPwszBuff,sizeof(WCHAR)*cchBuff);
-      ExFreePool(OutPwszBuff);
+      ExFreePoolWithTag(OutPwszBuff, TAG_STRING);
    }
    else
       ret = 0;
index a14a8e1..6a499ce 100644 (file)
@@ -387,7 +387,7 @@ IntCloneMenuItems(PMENU_OBJECT Destination, PMENU_OBJECT Source)
             NewMenuItem->Text.Buffer = (PWSTR)ExAllocatePoolWithTag(PagedPool, MenuItem->Text.MaximumLength, TAG_STRING);
             if(!NewMenuItem->Text.Buffer)
             {
-               ExFreePool(NewMenuItem);
+               ExFreePoolWithTag(NewMenuItem, TAG_MENUITEM);
                break;
             }
             RtlCopyUnicodeString(&NewMenuItem->Text, &MenuItem->Text);
@@ -938,7 +938,7 @@ IntInsertMenuItem(PMENU_OBJECT MenuObject, UINT uItem, BOOL fByPosition,
 
    if(!IntSetMenuItemInfo(SubMenu, MenuItem, ItemInfo))
    {
-      ExFreePool(MenuItem);
+      ExFreePoolWithTag(MenuItem, TAG_MENUITEM);
       return FALSE;
    }
 
index befedc2..bcff279 100644 (file)
@@ -1235,7 +1235,7 @@ CopyMsgToKernelMem(MSG *KernelModeMsg, MSG *UserModeMsg, PMSGMEMORY MsgMemoryEnt
          if (! NT_SUCCESS(Status))
          {
             DPRINT1("Failed to copy message to kernel: invalid usermode buffer\n");
-            ExFreePool(KernelMem);
+            ExFreePoolWithTag(KernelMem, TAG_MSG);
             return Status;
          }
       }
index 506def6..a13b87a 100644 (file)
@@ -341,7 +341,7 @@ IntSafeCopyUnicodeString(PUNICODE_STRING Dest,
       Status = MmCopyFromCaller(Dest->Buffer, Src, Dest->Length);
       if(!NT_SUCCESS(Status))
       {
-         ExFreePool(Dest->Buffer);
+         ExFreePoolWithTag(Dest->Buffer, TAG_STRING);
          Dest->Buffer = NULL;
          return Status;
       }
@@ -388,7 +388,7 @@ IntSafeCopyUnicodeStringTerminateNULL(PUNICODE_STRING Dest,
       Status = MmCopyFromCaller(Dest->Buffer, Src, Dest->Length);
       if(!NT_SUCCESS(Status))
       {
-         ExFreePool(Dest->Buffer);
+         ExFreePoolWithTag(Dest->Buffer, TAG_STRING);
          Dest->Buffer = NULL;
          return Status;
       }
index cc32ad5..f067761 100644 (file)
@@ -383,7 +383,7 @@ IntSystemParametersInfo(
                      if(!NT_SUCCESS(Status) || (KeyValuePartialInfo->Type != REG_SZ))
                      {
                         ZwClose(KeyHandle);
-                        ExFreePool(KeyValuePartialInfo);
+                        ExFreePoolWithTag(KeyValuePartialInfo, TAG_STRING);
                         return FALSE;
                      }
 
@@ -396,7 +396,7 @@ IntSystemParametersInfo(
                      {
                         TileNum = 0;
                      }
-                     ExFreePool(KeyValuePartialInfo);
+                     ExFreePoolWithTag(KeyValuePartialInfo, TAG_STRING);
 
                      /* start over again and look for the style*/
                      ResLength = 0;
@@ -418,7 +418,7 @@ IntSystemParametersInfo(
                      if(!NT_SUCCESS(Status) || (KeyValuePartialInfo->Type != REG_SZ))
                      {
                         ZwClose(KeyHandle);
-                        ExFreePool(KeyValuePartialInfo);
+                        ExFreePoolWithTag(KeyValuePartialInfo, TAG_STRING);
                         return FALSE;
                      }
 
@@ -431,7 +431,7 @@ IntSystemParametersInfo(
                      {
                         StyleNum = 0;
                      }
-                     ExFreePool(KeyValuePartialInfo);
+                     ExFreePoolWithTag(KeyValuePartialInfo, TAG_STRING);
 
                      /* Check the values we found in the registry */
                      if(TileNum && !StyleNum)
index f7d9b2c..7c676fe 100644 (file)
@@ -704,7 +704,7 @@ BITMAPOBJ_CopyBitmap(HBITMAP  hBitmap)
                        }
                        IntGetBitmapBits (Bitmap, bm.bmWidthBytes * abs(bm.bmHeight), buf);
                        IntSetBitmapBits (resBitmap, bm.bmWidthBytes * abs(bm.bmHeight), buf);
-                       ExFreePool (buf);
+                       ExFreePoolWithTag (buf,TAG_BITMAP);
                        resBitmap->flFlags = Bitmap->flFlags;
                        GDIOBJ_UnlockObjByPtr((POBJ)resBitmap);
                }
index 6969ea7..ecee3c0 100644 (file)
@@ -860,7 +860,6 @@ NtGdiStretchDIBitsInternal(
          * if it negitve we getting to many scanline for scanline is UINT not
          * a INT, so we need make the negtive value to positve and that make the
          * count correct for negtive bitmap, TODO : we need testcase for this api */
-
          IntSetDIBits(pDC, hBitmap, 0, abs(BitsInfo->bmiHeader.biHeight), Bits,
                   BitsInfo, Usage);
 
@@ -1187,7 +1186,7 @@ DIB_CreateDIBSection(
       {
         if (lpRGB != bmi->bmiColors)
           {
-            ExFreePool(lpRGB);
+            ExFreePoolWithTag(lpRGB, TAG_COLORMAP);
           }
         SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES);
        return NULL;
@@ -1197,7 +1196,7 @@ DIB_CreateDIBSection(
       {
         if (lpRGB != bmi->bmiColors)
           {
-            ExFreePool(lpRGB);
+            ExFreePoolWithTag(lpRGB, TAG_COLORMAP);
           }
        SetLastWin32Error(ERROR_INVALID_HANDLE);
        NtGdiDeleteObject(bmp);
@@ -1238,14 +1237,14 @@ DIB_CreateDIBSection(
       VirtualFree(bm.bmBits, 0L, MEM_RELEASE), bm.bmBits = NULL;
     } */
 
-    if (dib) { ExFreePool(dib); dib = NULL; }
+    if (dib) { ExFreePoolWithTag(dib, TAG_DIB); dib = NULL; }
     if (bmp) { bmp = NULL; }
     if (res) { BITMAPOBJ_FreeBitmapByHandle(res); res = 0; }
   }
 
   if (lpRGB != bmi->bmiColors)
     {
-      ExFreePool(lpRGB);
+      ExFreePoolWithTag(lpRGB, TAG_COLORMAP);
     }
 
   if (bmp)
index 52ab926..ba92470 100644 (file)
@@ -425,7 +425,7 @@ NtGdiPolyPolyDraw( IN HDC hDC,
 
     if (!NT_SUCCESS(Status))
     {
-        ExFreePool(pTemp);
+        ExFreePoolWithTag(pTemp, TAG_SHAPE);
         return FALSE;
     }
 
@@ -434,7 +434,7 @@ NtGdiPolyPolyDraw( IN HDC hDC,
     {
         HRGN hRgn;
         hRgn = IntCreatePolyPolygonRgn(SafePoints, SafeCounts, Count, (INT_PTR)hDC);
-        ExFreePool(pTemp);
+        ExFreePoolWithTag(pTemp, TAG_SHAPE);
         return (ULONG_PTR)hRgn;
     }
 
@@ -1001,7 +1001,7 @@ NtGdiGradientFill(
     if (!NT_SUCCESS(Status))
     {
         DC_UnlockDc(dc);
-        ExFreePool(SafeVertex);
+        ExFreePoolWithTag(SafeVertex, TAG_SHAPE);
         SetLastNtError(Status);
         return FALSE;
     }
index d761525..388614d 100644 (file)
@@ -371,7 +371,7 @@ IntGdiAddFontResource(PUNICODE_STRING FileName, DWORD Characteristics)
    {
       FT_Done_Face(Face);
       ObDereferenceObject(SectionObject);
-      ExFreePool(Entry);
+      ExFreePoolWithTag(Entry, TAG_FONT);
       SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
       return 0;
    }
@@ -382,7 +382,7 @@ IntGdiAddFontResource(PUNICODE_STRING FileName, DWORD Characteristics)
       EngFreeMem(FontGDI);
       FT_Done_Face(Face);
       ObDereferenceObject(SectionObject);
-      ExFreePool(Entry);
+      ExFreePoolWithTag(Entry, TAG_FONT);
       SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
       return 0;      
    }
@@ -1011,7 +1011,7 @@ FontFamilyFillInfo(PFONTFAMILYINFO Info, PCWSTR FaceName, PFONTGDI FontGDI)
   if (0 == (TM->tmPitchAndFamily & TMPF_VECTOR))
      Info->FontType |= RASTER_FONTTYPE;
 
-  ExFreePool(Otm);
+  ExFreePoolWithTag(Otm, TAG_GDITEXT);
 
   wcsncpy(Info->EnumLogFontEx.elfLogFont.lfFaceName, FaceName, LF_FACESIZE);
   wcsncpy(Info->EnumLogFontEx.elfFullName, FaceName, LF_FULLFACESIZE);
index aac2748..acb098c 100644 (file)
@@ -198,7 +198,7 @@ IntGdiPolyBezier(DC      *dc,
         if ( Pts )
         {
             ret = IntGdiPolyline(dc, Pts, nOut);
-            ExFreePool(Pts);
+            ExFreePoolWithTag(Pts, TAG_BEZIER);
         }
     }
 
@@ -228,7 +228,7 @@ IntGdiPolyBezierTo(DC      *dc,
             npt[0].y = Dc_Attr->ptlCurrent.y;
             memcpy(npt + 1, pt, sizeof(POINT) * Count);
             ret = IntGdiPolyBezier(dc, npt, Count+1);
-            ExFreePool(npt);
+            ExFreePoolWithTag(npt, TAG_BEZIER);
         }
     }
     if ( ret )
@@ -331,7 +331,7 @@ IntGdiPolylineTo(DC      *dc,
             pts[0].y = Dc_Attr->ptlCurrent.y;
             memcpy( pts + 1, pt, sizeof(POINT) * Count);
             ret = IntGdiPolyline(dc, pts, Count + 1);
-            ExFreePool(pts);
+            ExFreePoolWithTag(pts, TAG_SHAPE);
         }
     }
     if ( ret )
index 2220f7d..13171f2 100644 (file)
@@ -170,7 +170,7 @@ HPALETTE FASTCALL PALETTE_Init(VOID)
   }
 
   hpalette = NtGdiCreatePaletteInternal(palPtr,NB_RESERVED_COLORS);
-  ExFreePool(palPtr);
+  ExFreePoolWithTag(palPtr, TAG_PALETTE);
 
 #ifndef NO_MAPPING
   palObj = (PALOBJ*)PALETTE_LockPalette(hpalette);
index 7c9ac01..fad30cd 100644 (file)
@@ -181,8 +181,8 @@ PATH_DestroyGdiPath ( PPATH pPath )
 {
   ASSERT(pPath!=NULL);
 
-  if (pPath->pPoints) ExFreePool(pPath->pPoints);
-  if (pPath->pFlags) ExFreePool(pPath->pFlags);
+  if (pPath->pPoints) ExFreePoolWithTag(pPath->pPoints, TAG_PATH);
+  if (pPath->pFlags) ExFreePoolWithTag(pPath->pFlags, TAG_PATH);
 }
 
 /* PATH_AssignGdiPath
@@ -991,7 +991,7 @@ PATH_AddFlatBezier ( PPATH pPath, POINT *pt, BOOL closed )
   for(i = 1; i < no; i++)
     PATH_AddEntry(pPath, &pts[i],  (i == no-1 && closed) ? PT_LINETO | PT_CLOSEFIGURE : PT_LINETO);
 
-  ExFreePool(pts);
+  ExFreePoolWithTag(pts, TAG_BEZIER);
   return TRUE;
 }
 
@@ -1092,7 +1092,7 @@ PATH_PathToRegion ( PPATH pPath, INT nPolyFillMode, HRGN *pHrgn )
   }
 
   /* Free memory for number-of-points-in-stroke array */
-  ExFreePool(pNumPointsInStroke);
+  ExFreePoolWithTag(pNumPointsInStroke, TAG_PATH);
 
   /* Success! */
   *pHrgn=hrgn;
@@ -1189,7 +1189,7 @@ PATH_ReserveEntries ( PPATH pPath, INT numEntries )
     pFlagsNew=(BYTE *)ExAllocatePoolWithTag(PagedPool, numEntriesToAllocate * sizeof(BYTE), TAG_PATH);
     if(!pFlagsNew)
     {
-      ExFreePool(pPointsNew);
+      ExFreePoolWithTag(pPointsNew, TAG_PATH);
       return FALSE;
     }
 
@@ -1201,8 +1201,8 @@ PATH_ReserveEntries ( PPATH pPath, INT numEntries )
       memcpy(pPointsNew, pPath->pPoints, sizeof(POINT)*pPath->numEntriesUsed);
       memcpy(pFlagsNew, pPath->pFlags, sizeof(BYTE)*pPath->numEntriesUsed);
 
-      ExFreePool(pPath->pPoints);
-      ExFreePool(pPath->pFlags);
+      ExFreePoolWithTag(pPath->pPoints, TAG_PATH);
+      ExFreePoolWithTag(pPath->pFlags, TAG_PATH);
     }
     pPath->pPoints=pPointsNew;
     pPath->pFlags=pFlagsNew;
@@ -1424,12 +1424,12 @@ BOOL FASTCALL PATH_StrokePath(DC *dc, PPATH pPath)
                     }
 
                     memcpy(Realloc, pLinePts, nLinePts*sizeof(POINT));
-                    ExFreePool(pLinePts);
+                    ExFreePoolWithTag(pLinePts, TAG_PATH);
                     pLinePts = Realloc;
                 }
                 memcpy(&pLinePts[nLinePts], &pBzrPts[1], (nBzrPts - 1) * sizeof(POINT));
                 nLinePts += nBzrPts - 1;
-                ExFreePool(pBzrPts);
+                ExFreePoolWithTag(pBzrPts, TAG_BEZIER);
                 i += 2;
             }
             break;
@@ -1449,7 +1449,7 @@ BOOL FASTCALL PATH_StrokePath(DC *dc, PPATH pPath)
     ret = TRUE;
 
 end:
-    if(pLinePts)ExFreePool(pLinePts);
+    if(pLinePts) ExFreePoolWithTag(pLinePts, TAG_PATH);
 
     /* Restore the old mapping mode */
     Dc_Attr->iMapMode =  mapMode;
@@ -1534,13 +1534,13 @@ PATH_WidenPath(DC *dc)
     else
     {
         SetLastWin32Error(ERROR_CAN_NOT_COMPLETE);
-        ExFreePool(elp);
+        ExFreePoolWithTag(elp, TAG_PATH);
         PATH_UnlockPath( pPath );
         return FALSE;
     }
 
     penWidth = elp->elpWidth;
-    ExFreePool(elp);
+    ExFreePoolWithTag(elp, TAG_PATH);
 
     endcap = (PS_ENDCAP_MASK & penStyle);
     joint = (PS_JOIN_MASK & penStyle);
@@ -1588,7 +1588,7 @@ PATH_WidenPath(DC *dc)
                 }
                 numStrokes++;
                 j = 0;
-                ExFreePool(pStrokes);
+                ExFreePoolWithTag(pStrokes, TAG_PATH);
                 pStrokes = ExAllocatePoolWithTag(PagedPool, numStrokes * sizeof(PPATH), TAG_PATH);
                 pStrokes[numStrokes - 1] = ExAllocatePoolWithTag(PagedPool, sizeof(PATH), TAG_PATH);
 
@@ -1834,19 +1834,19 @@ PATH_WidenPath(DC *dc)
         }
 
         PATH_DestroyGdiPath(pStrokes[i]);
-        ExFreePool(pStrokes[i]);
+        ExFreePoolWithTag(pStrokes[i], TAG_PATH);
         PATH_DestroyGdiPath(pUpPath);
-        ExFreePool(pUpPath);
+        ExFreePoolWithTag(pUpPath, TAG_PATH);
         PATH_DestroyGdiPath(pDownPath);
-        ExFreePool(pDownPath);
+        ExFreePoolWithTag(pDownPath, TAG_PATH);
     }
-    ExFreePool(pStrokes);
+    ExFreePoolWithTag(pStrokes, TAG_PATH);
 
     pNewPath->state = PATH_Closed;
     if (!(ret = PATH_AssignGdiPath(pPath, pNewPath)))
         DPRINT1("Assign path failed\n");
     PATH_DestroyGdiPath(pNewPath);
-    ExFreePool(pNewPath);
+    ExFreePoolWithTag(pNewPath, TAG_PATH);
     return ret;
 }
 
index e40042e..85e0c3a 100644 (file)
@@ -223,7 +223,7 @@ NtGdiExtEscape(
 
       if ( !NT_SUCCESS(Status) )
       {
-         ExFreePool ( SafeInData );
+         ExFreePoolWithTag ( SafeInData, TAG_PRINT );
          DC_UnlockDc(pDC);
          SetLastNtError(Status);
          return -1;
@@ -256,7 +256,7 @@ NtGdiExtEscape(
          SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
 freeout:
          if ( SafeInData )
-            ExFreePool ( SafeInData );
+            ExFreePoolWithTag ( SafeInData, TAG_PRINT );
          DC_UnlockDc(pDC);
          return -1;
       }
@@ -267,7 +267,7 @@ freeout:
    DC_UnlockDc(pDC);
 
    if ( SafeInData )
-      ExFreePool ( SafeInData );
+      ExFreePoolWithTag ( SafeInData ,TAG_PRINT );
 
    if ( SafeOutData )
    {
@@ -284,7 +284,7 @@ freeout:
       }
       _SEH_END;
 
-      ExFreePool ( SafeOutData );
+      ExFreePoolWithTag ( SafeOutData, TAG_PRINT );
       if ( !NT_SUCCESS(Status) )
       {
          SetLastNtError(Status);
index 80864b5..a890bc9 100644 (file)
@@ -420,7 +420,7 @@ static __inline int xmemcheck(ROSRGNDATA *reg, PRECT *rect, PRECT *firstrect)
         }
         temp = ExAllocatePoolWithTag(PagedPool, NewSize, TAG_REGION);
 
-        if (temp == 0)
+        if (temp == NULL)
         {
             return 0;
         }
@@ -431,7 +431,7 @@ static __inline int xmemcheck(ROSRGNDATA *reg, PRECT *rect, PRECT *firstrect)
         reg->rdh.nRgnSize = NewSize;
         if (*firstrect != &reg->rdh.rcBound)
         {
-            ExFreePool(*firstrect);
+            ExFreePoolWithTag(*firstrect, TAG_REGION);
         }
         *firstrect = temp;
         *rect = (*firstrect)+reg->rdh.nCount;
@@ -520,7 +520,7 @@ REGION_CopyRegion(
                 return FALSE;
 
             if (dst->Buffer && dst->Buffer != &dst->rdh.rcBound)
-                ExFreePool(dst->Buffer);       //free the old buffer
+                ExFreePoolWithTag(dst->Buffer, TAG_REGION);    //free the old buffer
             dst->Buffer = temp;
             dst->rdh.nRgnSize = src->rdh.nCount * sizeof(RECT);  //size of region buffer
         }
@@ -608,7 +608,7 @@ REGION_CropAndOffsetRegion(
         {
             xrect = ExAllocatePoolWithTag(PagedPool, rgnSrc->rdh.nCount * sizeof(RECT), TAG_REGION);
             if (rgnDst->Buffer && rgnDst->Buffer != &rgnDst->rdh.rcBound)
-                ExFreePool(rgnDst->Buffer); //free the old buffer. will be assigned to xrect below.
+                ExFreePoolWithTag(rgnDst->Buffer, TAG_REGION); //free the old buffer. will be assigned to xrect below.
         }
 
         if (xrect)
@@ -676,7 +676,7 @@ REGION_CropAndOffsetRegion(
                 return FALSE;
 
             if (rgnDst->Buffer && rgnDst->Buffer != &rgnDst->rdh.rcBound)
-                ExFreePool(rgnDst->Buffer); //free the old buffer
+                ExFreePoolWithTag(rgnDst->Buffer, TAG_REGION); //free the old buffer
             rgnDst->Buffer = temp;
             rgnDst->rdh.nCount = i;
             rgnDst->rdh.nRgnSize = i * sizeof(RECT);
@@ -1169,7 +1169,7 @@ REGION_RegionOp(
                 newReg->rdh.nRgnSize = newReg->rdh.nCount*sizeof(RECT);
                 COPY_RECTS(newReg->Buffer, prev_rects, newReg->rdh.nCount);
                 if (prev_rects != &newReg->rdh.rcBound)
-                    ExFreePool(prev_rects);
+                    ExFreePoolWithTag(prev_rects, TAG_REGION);
             }
         }
         else
@@ -1180,7 +1180,7 @@ REGION_RegionOp(
              */
             newReg->rdh.nRgnSize = sizeof(RECT);
             if (newReg->Buffer != &newReg->rdh.rcBound)
-                ExFreePool(newReg->Buffer);
+                ExFreePoolWithTag(newReg->Buffer, TAG_REGION);
             newReg->Buffer = ExAllocatePoolWithTag(PagedPool, sizeof(RECT), TAG_REGION);
             ASSERT(newReg->Buffer);
         }
@@ -1188,7 +1188,7 @@ REGION_RegionOp(
     newReg->rdh.iType = RDH_RECTANGLES;
 
     if (oldRects != &newReg->rdh.rcBound)
-        ExFreePool(oldRects);
+        ExFreePoolWithTag(oldRects, TAG_REGION);
     return;
 }
 
@@ -3475,7 +3475,7 @@ REGION_PtsToRegion(
     {
         COPY_RECTS(temp, reg->Buffer, reg->rdh.nCount);
         if (reg->Buffer != &reg->rdh.rcBound)
-            ExFreePool(reg->Buffer);
+            ExFreePoolWithTag(reg->Buffer, TAG_REGION);
     }
     reg->Buffer = temp;
 
@@ -3754,7 +3754,7 @@ IntCreatePolyPolygonRgn(
                     if (!tmpPtBlock)
                     {
                         DPRINT1("Can't alloc tPB\n");
-                        ExFreePool(pETEs);
+                        ExFreePoolWithTag(pETEs, TAG_REGION);
                         return 0;
                     }
                     curPtBlock->next = tmpPtBlock;
@@ -3813,7 +3813,7 @@ IntCreatePolyPolygonRgn(
                         if (!tmpPtBlock)
                         {
                             DPRINT1("Can't alloc tPB\n");
-                            ExFreePool(pETEs);
+                            ExFreePoolWithTag(pETEs, TAG_REGION);
                             NtGdiDeleteObject(hrgn);
                             return 0;
                         }
@@ -3845,10 +3845,10 @@ IntCreatePolyPolygonRgn(
     for (curPtBlock = FirstPtBlock.next; --numFullPtBlocks >= 0;)
     {
         tmpPtBlock = curPtBlock->next;
-        ExFreePool(curPtBlock);
+        ExFreePoolWithTag(curPtBlock, TAG_REGION);
         curPtBlock = tmpPtBlock;
     }
-    ExFreePool(pETEs);
+    ExFreePoolWithTag(pETEs, TAG_REGION);
     REGION_UnlockRgn(region);
     return hrgn;
 }
index c65ee5b..0e2f28e 100644 (file)
@@ -178,7 +178,7 @@ NtGdiGetTextExtentExW(
       Dx = ExAllocatePoolWithTag(PagedPool, Count * sizeof(INT), TAG_GDITEXT);
       if (NULL == Dx)
        {
-         ExFreePool(String);
+         ExFreePoolWithTag(String, TAG_GDITEXT);
          SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
          return FALSE;
        }
@@ -193,9 +193,9 @@ NtGdiGetTextExtentExW(
     {
       if (NULL != Dx)
        {
-         ExFreePool(Dx);
+         ExFreePoolWithTag(Dx, TAG_GDITEXT);
        }
-      ExFreePool(String);
+      ExFreePoolWithTag(String, TAG_GDITEXT);
       SetLastNtError(Status);
       return FALSE;
     }
@@ -205,9 +205,9 @@ NtGdiGetTextExtentExW(
     {
       if (NULL != Dx)
        {
-         ExFreePool(Dx);
+         ExFreePoolWithTag(Dx, TAG_GDITEXT);
        }
-      ExFreePool(String);
+      ExFreePoolWithTag(String, TAG_GDITEXT);
       SetLastWin32Error(ERROR_INVALID_HANDLE);
       return FALSE;
     }
@@ -224,12 +224,12 @@ NtGdiGetTextExtentExW(
     Result = FALSE;
   DC_UnlockDc(dc);
 
-  ExFreePool(String);
+  ExFreePoolWithTag(String, TAG_GDITEXT);
   if (! Result)
     {
       if (NULL != Dx)
        {
-         ExFreePool(Dx);
+         ExFreePoolWithTag(Dx, TAG_GDITEXT);
        }
       return FALSE;
     }
@@ -241,7 +241,7 @@ NtGdiGetTextExtentExW(
        {
          if (NULL != Dx)
            {
-             ExFreePool(Dx);
+             ExFreePoolWithTag(Dx, TAG_GDITEXT);
            }
          SetLastNtError(Status);
          return FALSE;
@@ -255,7 +255,7 @@ NtGdiGetTextExtentExW(
        {
          if (NULL != Dx)
            {
-             ExFreePool(Dx);
+             ExFreePoolWithTag(Dx, TAG_GDITEXT);
            }
          SetLastNtError(Status);
          return FALSE;
@@ -263,7 +263,7 @@ NtGdiGetTextExtentExW(
     }
   if (NULL != Dx)
     {
-      ExFreePool(Dx);
+      ExFreePoolWithTag(Dx,TAG_GDITEXT);
     }
 
   Status = MmCopyToCaller(UnsafeSize, &Size, sizeof(SIZE));