mirror of
https://github.com/reactos/reactos.git
synced 2024-07-06 12:45:16 +00:00
[KS]
- Avoid leaking AllocatorFraming in KsCreateDefaultAllocatorEx. Patch by Sebastian Gasiorek CORE-12797 #resolve svn path=/trunk/; revision=73856
This commit is contained in:
parent
ca4c2640e7
commit
d920d6c30a
|
@ -593,20 +593,27 @@ KsCreateDefaultAllocatorEx(
|
|||
|
||||
/* check the valid file alignment */
|
||||
if (AllocatorFraming->FileAlignment > (PAGE_SIZE-1))
|
||||
{
|
||||
FreeItem(AllocatorFraming);
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* allocate allocator struct */
|
||||
Allocator = AllocateItem(NonPagedPool, sizeof(ALLOCATOR));
|
||||
if (!Allocator)
|
||||
{
|
||||
FreeItem(AllocatorFraming);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
/* allocate object header */
|
||||
|
||||
Status = KsAllocateObjectHeader((KSOBJECT_HEADER*)&Allocator->Header, 0, NULL, Irp, &DispatchTable);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
FreeItem(Allocator);
|
||||
return Status;
|
||||
FreeItem(AllocatorFraming);
|
||||
FreeItem(Allocator);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* set allocator type in object header */
|
||||
|
@ -652,6 +659,7 @@ KsCreateDefaultAllocatorEx(
|
|||
|
||||
/* backup allocator framing */
|
||||
RtlMoveMemory(&Allocator->Status.Framing, AllocatorFraming, sizeof(KSALLOCATOR_FRAMING));
|
||||
FreeItem(AllocatorFraming);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue