[NTOSKRNL]

- ExFreePool --> ExFreePoolWithTag in some places.
- Remove dead code (section.c)
- Free resource (sysldr.c)

svn path=/trunk/; revision=57412
This commit is contained in:
Hermès Bélusca-Maïto 2012-09-28 12:17:23 +00:00
parent 23d6a39557
commit 24a14abf27
11 changed files with 47 additions and 42 deletions

View File

@ -555,7 +555,7 @@ MmCreateCacheSection(PROS_SECTION_OBJECT *SectionObject,
{
KeReleaseSpinLock(&FileObject->IrpListLock, OldIrql);
DPRINTC("Free Segment %x\n", Segment);
ExFreePool(Segment);
ExFreePoolWithTag(Segment, TAG_MM_SECTION_SEGMENT);
DPRINT("Filling out Segment info (previous data section)\n");

View File

@ -1347,7 +1347,7 @@ NtLockFile(IN HANDLE FileHandle,
{
/* Allocating failed, clean up and return the exception code */
IopCleanupAfterException(FileObject, Irp, Event, NULL);
if (LocalLength) ExFreePool(LocalLength);
if (LocalLength) ExFreePoolWithTag(LocalLength, TAG_LOCK);
/* Return the exception code */
_SEH2_YIELD(return _SEH2_GetExceptionCode());
@ -1450,7 +1450,7 @@ NtQueryDirectoryFile(IN HANDLE FileHandle,
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
/* Free buffer and return the exception code */
if (AuxBuffer) ExFreePool(AuxBuffer);
if (AuxBuffer) ExFreePoolWithTag(AuxBuffer, TAG_SYSB);
_SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
@ -1466,7 +1466,7 @@ NtQueryDirectoryFile(IN HANDLE FileHandle,
if (!NT_SUCCESS(Status))
{
/* Fail */
if (AuxBuffer) ExFreePool(AuxBuffer);
if (AuxBuffer) ExFreePoolWithTag(AuxBuffer, TAG_SYSB);
return Status;
}
@ -1539,7 +1539,7 @@ NtQueryDirectoryFile(IN HANDLE FileHandle,
{
/* Allocating failed, clean up and return the exception code */
IopCleanupAfterException(FileObject, Irp, Event, NULL);
if (AuxBuffer) ExFreePool(AuxBuffer);
if (AuxBuffer) ExFreePoolWithTag(AuxBuffer, TAG_SYSB);
/* Return the exception code */
_SEH2_YIELD(return _SEH2_GetExceptionCode());
@ -1863,7 +1863,7 @@ NtQueryInformationFile(IN HANDLE FileHandle,
_SEH2_END;
/* Free the event */
ExFreePool(Event);
ExFreePoolWithTag(Event, TAG_IO);
}
else
{
@ -2465,7 +2465,7 @@ NtSetInformationFile(IN HANDLE FileHandle,
* Someone else set the completion port in the
* meanwhile, so dereference the port and fail.
*/
ExFreePool(Context);
ExFreePoolWithTag(Context, IOC_TAG);
ObDereferenceObject(Queue);
Status = STATUS_INVALID_PARAMETER;
}
@ -2524,7 +2524,7 @@ NtSetInformationFile(IN HANDLE FileHandle,
_SEH2_END;
/* Free the event */
ExFreePool(Event);
ExFreePoolWithTag(Event, TAG_IO);
}
else
{
@ -2555,7 +2555,7 @@ NtSetInformationFile(IN HANDLE FileHandle,
{
/* Clear it in the IRP for completion */
Irp->UserEvent = NULL;
ExFreePool(Event);
ExFreePoolWithTag(Event, TAG_IO);
}
/* Set the caller IOSB */
@ -2722,7 +2722,7 @@ NtUnlockFile(IN HANDLE FileHandle,
/* Allocate a buffer */
LocalLength = ExAllocatePoolWithTag(NonPagedPool,
sizeof(LARGE_INTEGER),
TAG_LOCK);
TAG_LOCK);
/* Set the length */
*LocalLength = CapturedLength;
@ -2733,7 +2733,7 @@ NtUnlockFile(IN HANDLE FileHandle,
{
/* Allocating failed, clean up and return the exception code */
IopCleanupAfterException(FileObject, Irp, NULL, Event);
if (LocalLength) ExFreePool(LocalLength);
if (LocalLength) ExFreePoolWithTag(LocalLength, TAG_LOCK);
/* Return the exception code */
_SEH2_YIELD(return _SEH2_GetExceptionCode());

View File

@ -103,7 +103,7 @@ IoConnectInterrupt(OUT PKINTERRUPT *InterruptObject,
if (FirstRun)
{
/* We failed early so just free this */
ExFreePool(IoInterrupt);
ExFreePoolWithTag(IoInterrupt, TAG_KINTERRUPT);
}
else
{
@ -163,7 +163,7 @@ IoDisconnectInterrupt(PKINTERRUPT InterruptObject)
}
/* Free the I/O Interrupt */
ExFreePool(IoInterrupt);
ExFreePool(IoInterrupt); // ExFreePoolWithTag(IoInterrupt, TAG_KINTERRUPT);
}
/* EOF */

View File

@ -200,7 +200,7 @@ Cleanup:
//
// Free the table if we failed and return status
//
if (DriverThunks) ExFreePool(DriverThunks);
if (DriverThunks) ExFreePoolWithTag(DriverThunks, 'tVmM');
return Status;
}

View File

@ -358,7 +358,7 @@ ExpComputeHashForTag(IN ULONG Tag,
// Finally, AND with the bucket mask to generate a valid index/bucket into
// the table
//
ULONGLONG Result = 40543 * Tag;
ULONGLONG Result = (ULONGLONG)40543 * Tag;
return (ULONG)BucketMask & ((ULONG)Result ^ (Result >> 32));
}
@ -1185,7 +1185,7 @@ ExGetPoolTagInfo(IN PSYSTEM_POOLTAG_INFORMATION SystemInformation,
//
// Free the "Generic DPC" temporary buffer, return the buffer length and status
//
ExFreePool(Buffer);
ExFreePoolWithTag(Buffer, 'ofnI');
if (ReturnLength) *ReturnLength = CurrentLength;
return Status;
}

View File

@ -1172,7 +1172,7 @@ MmFreeLoaderBlock(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
KeFlushCurrentTb();
/* Free our run structure */
ExFreePool(Buffer);
ExFreePoolWithTag(Buffer, 'lMmM');
}
VOID

View File

@ -663,7 +663,7 @@ MiResolveTransitionFault(IN PVOID FaultingAddress,
ASSERT(Pfn1->u3.e1.ReadInProgress == 0);
/* Windows checks there's some free pages and this isn't an in-page error */
ASSERT(MmAvailablePages >= 0);
ASSERT(MmAvailablePages > 0);
ASSERT(Pfn1->u4.InPageError == 0);
/* ReactOS checks for this */

View File

@ -118,7 +118,11 @@ MiCreatePebOrTeb(IN PEPROCESS Process,
Base,
&Parent);
/* Bail out, if still nothing free was found */
if (Result == TableFoundNode) return STATUS_NO_MEMORY;
if (Result == TableFoundNode)
{
ExFreePoolWithTag(Vad, 'ldaV');
return STATUS_NO_MEMORY;
}
}
/* Validate that it came from the VAD ranges */
@ -1857,6 +1861,7 @@ MiSessionCreateInternal(OUT PULONG SessionId)
{
/* We ran out of session IDs, we should expand */
DPRINT1("Too many sessions created. Expansion not yet supported\n");
ExFreePoolWithTag(PageTables, 'tHmM');
return STATUS_NO_MEMORY;
}

View File

@ -1,11 +1,11 @@
/*
* PROJECT: ReactOS Kernel
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: ntoskrnl/mm/ARM3/sysldr.c
* PURPOSE: Contains the Kernel Loader (SYSLDR) for loading PE files.
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
* ReactOS Portable Systems Group
*/
* PROJECT: ReactOS Kernel
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: ntoskrnl/mm/ARM3/sysldr.c
* PURPOSE: Contains the Kernel Loader (SYSLDR) for loading PE files.
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
* ReactOS Portable Systems Group
*/
/* INCLUDES *******************************************************************/
@ -2179,9 +2179,13 @@ MiInitializeLoadedModuleList(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
NewEntry->FullDllName.Buffer =
ExAllocatePoolWithTag(PagedPool,
LdrEntry->FullDllName.MaximumLength +
sizeof(UNICODE_NULL),
sizeof(UNICODE_NULL),
TAG_LDR_WSTR);
if (!NewEntry->FullDllName.Buffer) return FALSE;
if (!NewEntry->FullDllName.Buffer)
{
ExFreePoolWithTag(NewEntry, TAG_MODULE_OBJECT);
return FALSE;
}
/* Set the base name */
NewEntry->BaseDllName.Buffer = (PVOID)(NewEntry + 1);
@ -3436,3 +3440,4 @@ MmGetSystemRoutineAddress(IN PUNICODE_STRING SystemRoutineName)
return ProcAddress;
}
/* EOF */

View File

@ -1099,7 +1099,7 @@ MiDoPoolCopy(IN PEPROCESS SourceProcess,
//
// Check if we had allocated pool
//
if (HavePoolAddress) ExFreePool(PoolAddress);
if (HavePoolAddress) ExFreePoolWithTag(PoolAddress, 'VmRw');
//
// Check if we failed during the probe
@ -1160,7 +1160,7 @@ MiDoPoolCopy(IN PEPROCESS SourceProcess,
//
// Check if we had allocated pool
//
if (HavePoolAddress) ExFreePool(PoolAddress);
if (HavePoolAddress) ExFreePoolWithTag(PoolAddress, 'VmRw');
//
// All bytes read

View File

@ -1761,17 +1761,12 @@ MmAccessFaultSectionView(PMMSUPPORT AddressSpace,
Region->Protect,
&NewPage,
1);
if (!NT_SUCCESS(Status))
{
DPRINT("MmCreateVirtualMapping failed, not out of memory\n");
KeBugCheck(MEMORY_MANAGEMENT);
return(Status);
}
if (!NT_SUCCESS(Status))
{
DPRINT1("Unable to create virtual mapping\n");
KeBugCheck(MEMORY_MANAGEMENT);
}
if (!NT_SUCCESS(Status))
{
DPRINT1("MmCreateVirtualMapping failed, unable to create virtual mapping, not out of memory\n");
KeBugCheck(MEMORY_MANAGEMENT);
return(Status);
}
/*
* Unshare the old page.
@ -3786,7 +3781,7 @@ MmCreateImageSection(PROS_SECTION_OBJECT *SectionObject,
if(ImageSectionObject->Segments != NULL)
ExFreePool(ImageSectionObject->Segments);
ExFreePool(ImageSectionObject);
ExFreePoolWithTag(ImageSectionObject, TAG_MM_SECTION_SEGMENT);
ObDereferenceObject(Section);
ObDereferenceObject(FileObject);
return(StatusExeFmt);