[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); KeReleaseSpinLock(&FileObject->IrpListLock, OldIrql);
DPRINTC("Free Segment %x\n", Segment); DPRINTC("Free Segment %x\n", Segment);
ExFreePool(Segment); ExFreePoolWithTag(Segment, TAG_MM_SECTION_SEGMENT);
DPRINT("Filling out Segment info (previous data section)\n"); 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 */ /* Allocating failed, clean up and return the exception code */
IopCleanupAfterException(FileObject, Irp, Event, NULL); IopCleanupAfterException(FileObject, Irp, Event, NULL);
if (LocalLength) ExFreePool(LocalLength); if (LocalLength) ExFreePoolWithTag(LocalLength, TAG_LOCK);
/* Return the exception code */ /* Return the exception code */
_SEH2_YIELD(return _SEH2_GetExceptionCode()); _SEH2_YIELD(return _SEH2_GetExceptionCode());
@ -1450,7 +1450,7 @@ NtQueryDirectoryFile(IN HANDLE FileHandle,
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{ {
/* Free buffer and return the exception code */ /* Free buffer and return the exception code */
if (AuxBuffer) ExFreePool(AuxBuffer); if (AuxBuffer) ExFreePoolWithTag(AuxBuffer, TAG_SYSB);
_SEH2_YIELD(return _SEH2_GetExceptionCode()); _SEH2_YIELD(return _SEH2_GetExceptionCode());
} }
_SEH2_END; _SEH2_END;
@ -1466,7 +1466,7 @@ NtQueryDirectoryFile(IN HANDLE FileHandle,
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
/* Fail */ /* Fail */
if (AuxBuffer) ExFreePool(AuxBuffer); if (AuxBuffer) ExFreePoolWithTag(AuxBuffer, TAG_SYSB);
return Status; return Status;
} }
@ -1539,7 +1539,7 @@ NtQueryDirectoryFile(IN HANDLE FileHandle,
{ {
/* Allocating failed, clean up and return the exception code */ /* Allocating failed, clean up and return the exception code */
IopCleanupAfterException(FileObject, Irp, Event, NULL); IopCleanupAfterException(FileObject, Irp, Event, NULL);
if (AuxBuffer) ExFreePool(AuxBuffer); if (AuxBuffer) ExFreePoolWithTag(AuxBuffer, TAG_SYSB);
/* Return the exception code */ /* Return the exception code */
_SEH2_YIELD(return _SEH2_GetExceptionCode()); _SEH2_YIELD(return _SEH2_GetExceptionCode());
@ -1863,7 +1863,7 @@ NtQueryInformationFile(IN HANDLE FileHandle,
_SEH2_END; _SEH2_END;
/* Free the event */ /* Free the event */
ExFreePool(Event); ExFreePoolWithTag(Event, TAG_IO);
} }
else else
{ {
@ -2465,7 +2465,7 @@ NtSetInformationFile(IN HANDLE FileHandle,
* Someone else set the completion port in the * Someone else set the completion port in the
* meanwhile, so dereference the port and fail. * meanwhile, so dereference the port and fail.
*/ */
ExFreePool(Context); ExFreePoolWithTag(Context, IOC_TAG);
ObDereferenceObject(Queue); ObDereferenceObject(Queue);
Status = STATUS_INVALID_PARAMETER; Status = STATUS_INVALID_PARAMETER;
} }
@ -2524,7 +2524,7 @@ NtSetInformationFile(IN HANDLE FileHandle,
_SEH2_END; _SEH2_END;
/* Free the event */ /* Free the event */
ExFreePool(Event); ExFreePoolWithTag(Event, TAG_IO);
} }
else else
{ {
@ -2555,7 +2555,7 @@ NtSetInformationFile(IN HANDLE FileHandle,
{ {
/* Clear it in the IRP for completion */ /* Clear it in the IRP for completion */
Irp->UserEvent = NULL; Irp->UserEvent = NULL;
ExFreePool(Event); ExFreePoolWithTag(Event, TAG_IO);
} }
/* Set the caller IOSB */ /* Set the caller IOSB */
@ -2722,7 +2722,7 @@ NtUnlockFile(IN HANDLE FileHandle,
/* Allocate a buffer */ /* Allocate a buffer */
LocalLength = ExAllocatePoolWithTag(NonPagedPool, LocalLength = ExAllocatePoolWithTag(NonPagedPool,
sizeof(LARGE_INTEGER), sizeof(LARGE_INTEGER),
TAG_LOCK); TAG_LOCK);
/* Set the length */ /* Set the length */
*LocalLength = CapturedLength; *LocalLength = CapturedLength;
@ -2733,7 +2733,7 @@ NtUnlockFile(IN HANDLE FileHandle,
{ {
/* Allocating failed, clean up and return the exception code */ /* Allocating failed, clean up and return the exception code */
IopCleanupAfterException(FileObject, Irp, NULL, Event); IopCleanupAfterException(FileObject, Irp, NULL, Event);
if (LocalLength) ExFreePool(LocalLength); if (LocalLength) ExFreePoolWithTag(LocalLength, TAG_LOCK);
/* Return the exception code */ /* Return the exception code */
_SEH2_YIELD(return _SEH2_GetExceptionCode()); _SEH2_YIELD(return _SEH2_GetExceptionCode());

View file

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

View file

@ -200,7 +200,7 @@ Cleanup:
// //
// Free the table if we failed and return status // Free the table if we failed and return status
// //
if (DriverThunks) ExFreePool(DriverThunks); if (DriverThunks) ExFreePoolWithTag(DriverThunks, 'tVmM');
return Status; 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 // Finally, AND with the bucket mask to generate a valid index/bucket into
// the table // the table
// //
ULONGLONG Result = 40543 * Tag; ULONGLONG Result = (ULONGLONG)40543 * Tag;
return (ULONG)BucketMask & ((ULONG)Result ^ (Result >> 32)); 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 // Free the "Generic DPC" temporary buffer, return the buffer length and status
// //
ExFreePool(Buffer); ExFreePoolWithTag(Buffer, 'ofnI');
if (ReturnLength) *ReturnLength = CurrentLength; if (ReturnLength) *ReturnLength = CurrentLength;
return Status; return Status;
} }

View file

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

View file

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

View file

@ -118,7 +118,11 @@ MiCreatePebOrTeb(IN PEPROCESS Process,
Base, Base,
&Parent); &Parent);
/* Bail out, if still nothing free was found */ /* 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 */ /* 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 */ /* We ran out of session IDs, we should expand */
DPRINT1("Too many sessions created. Expansion not yet supported\n"); DPRINT1("Too many sessions created. Expansion not yet supported\n");
ExFreePoolWithTag(PageTables, 'tHmM');
return STATUS_NO_MEMORY; return STATUS_NO_MEMORY;
} }

View file

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

View file

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

View file

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