diff --git a/ntoskrnl/mm/ARM3/section.c b/ntoskrnl/mm/ARM3/section.c index 40d942f7703..ad20d01e093 100644 --- a/ntoskrnl/mm/ARM3/section.c +++ b/ntoskrnl/mm/ARM3/section.c @@ -1494,6 +1494,11 @@ MiMapViewOfDataSection(IN PCONTROL_AREA ControlArea, if (!NT_SUCCESS(Status)) { ExFreePoolWithTag(Vad, 'ldaV'); + MiDereferenceControlArea(ControlArea); + + KeAcquireGuardedMutex(&MmSectionCommitMutex); + Segment->NumberOfCommittedPages -= QuotaCharge; + KeReleaseGuardedMutex(&MmSectionCommitMutex); return Status; } @@ -1506,6 +1511,13 @@ MiMapViewOfDataSection(IN PCONTROL_AREA ControlArea, AllocationType); if (!NT_SUCCESS(Status)) { + ExFreePoolWithTag(Vad, 'ldaV'); + MiDereferenceControlArea(ControlArea); + + KeAcquireGuardedMutex(&MmSectionCommitMutex); + Segment->NumberOfCommittedPages -= QuotaCharge; + KeReleaseGuardedMutex(&MmSectionCommitMutex); + PsReturnProcessNonPagedPoolQuota(PsGetCurrentProcess(), sizeof(MMVAD_LONG)); return Status; }