[KMTESTS:MM]
authorThomas Faber <thomas.faber@reactos.org>
Tue, 30 Jun 2015 10:54:41 +0000 (10:54 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Tue, 30 Jun 2015 10:54:41 +0000 (10:54 +0000)
- Fix some massive NP pool leakage.

svn path=/trunk/; revision=68318

rostests/kmtests/ntos_mm/MmMdl.c

index 85dd3fc..986a17a 100644 (file)
@@ -35,6 +35,7 @@ TestMmAllocatePagesForMdl(VOID)
     ok(MmGetMdlVirtualAddress(Mdl) == NULL, "Virtual address: %p\n", MmGetMdlVirtualAddress(Mdl));
     ok(!(Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA), "MdlFlags: %lx\n", Mdl->MdlFlags);
     MmFreePagesFromMdl(Mdl);
     ok(MmGetMdlVirtualAddress(Mdl) == NULL, "Virtual address: %p\n", MmGetMdlVirtualAddress(Mdl));
     ok(!(Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA), "MdlFlags: %lx\n", Mdl->MdlFlags);
     MmFreePagesFromMdl(Mdl);
+    ExFreePoolWithTag(Mdl, 0);
 
     /* Now map/unmap it */
     Mdl = MmAllocatePagesForMdl(LowAddress,
 
     /* Now map/unmap it */
     Mdl = MmAllocatePagesForMdl(LowAddress,
@@ -66,6 +67,7 @@ TestMmAllocatePagesForMdl(VOID)
     ok(MmGetMdlVirtualAddress(Mdl) == NULL, "Virtual address: %p\n", MmGetMdlVirtualAddress(Mdl));
     ok(!(Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA), "MdlFlags: %lx\n", Mdl->MdlFlags);
     MmFreePagesFromMdl(Mdl);
     ok(MmGetMdlVirtualAddress(Mdl) == NULL, "Virtual address: %p\n", MmGetMdlVirtualAddress(Mdl));
     ok(!(Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA), "MdlFlags: %lx\n", Mdl->MdlFlags);
     MmFreePagesFromMdl(Mdl);
+    ExFreePoolWithTag(Mdl, 0);
 
     /* Now map it, and free without unmapping */
     Mdl = MmAllocatePagesForMdl(LowAddress,
 
     /* Now map it, and free without unmapping */
     Mdl = MmAllocatePagesForMdl(LowAddress,
@@ -90,6 +92,7 @@ TestMmAllocatePagesForMdl(VOID)
     ok(Mdl->MappedSystemVa == SystemVa, "MappedSystemVa: %p, System VA: %p\n", Mdl->MappedSystemVa, SystemVa);
     ok((Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA), "MdlFlags: %lx\n", Mdl->MdlFlags);
     MmFreePagesFromMdl(Mdl);
     ok(Mdl->MappedSystemVa == SystemVa, "MappedSystemVa: %p, System VA: %p\n", Mdl->MappedSystemVa, SystemVa);
     ok((Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA), "MdlFlags: %lx\n", Mdl->MdlFlags);
     MmFreePagesFromMdl(Mdl);
+    ExFreePoolWithTag(Mdl, 0);
 
     /* try to allocate 2 GB -- should succeed but not map */
     Mdl = MmAllocatePagesForMdl(LowAddress,
 
     /* try to allocate 2 GB -- should succeed but not map */
     Mdl = MmAllocatePagesForMdl(LowAddress,
@@ -115,6 +118,7 @@ TestMmAllocatePagesForMdl(VOID)
         ok(MmGetMdlVirtualAddress(Mdl) == NULL, "Virtual address: %p\n", MmGetMdlVirtualAddress(Mdl));
         ok(!(Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA), "MdlFlags: %lx\n", Mdl->MdlFlags);
         MmFreePagesFromMdl(Mdl);
         ok(MmGetMdlVirtualAddress(Mdl) == NULL, "Virtual address: %p\n", MmGetMdlVirtualAddress(Mdl));
         ok(!(Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA), "MdlFlags: %lx\n", Mdl->MdlFlags);
         MmFreePagesFromMdl(Mdl);
+        ExFreePoolWithTag(Mdl, 0);
     }
 
     /* now allocate and map 32 MB Mdls until we fail */
     }
 
     /* now allocate and map 32 MB Mdls until we fail */
@@ -157,6 +161,7 @@ TestMmAllocatePagesForMdl(VOID)
         if (SystemVas[i] != NULL)
             MmUnmapLockedPages(SystemVas[i], Mdls[i]);
         MmFreePagesFromMdl(Mdls[i]);
         if (SystemVas[i] != NULL)
             MmUnmapLockedPages(SystemVas[i], Mdls[i]);
         MmFreePagesFromMdl(Mdls[i]);
+        ExFreePoolWithTag(Mdls[i], 0);
         if (SystemVas[i] == NULL)
             break;
     }
         if (SystemVas[i] == NULL)
             break;
     }