mirror of
https://github.com/reactos/reactos.git
synced 2024-07-11 15:15:27 +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 */
|
/* check the valid file alignment */
|
||||||
if (AllocatorFraming->FileAlignment > (PAGE_SIZE-1))
|
if (AllocatorFraming->FileAlignment > (PAGE_SIZE-1))
|
||||||
|
{
|
||||||
|
FreeItem(AllocatorFraming);
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
/* allocate allocator struct */
|
/* allocate allocator struct */
|
||||||
Allocator = AllocateItem(NonPagedPool, sizeof(ALLOCATOR));
|
Allocator = AllocateItem(NonPagedPool, sizeof(ALLOCATOR));
|
||||||
if (!Allocator)
|
if (!Allocator)
|
||||||
|
{
|
||||||
|
FreeItem(AllocatorFraming);
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
/* allocate object header */
|
/* allocate object header */
|
||||||
|
|
||||||
Status = KsAllocateObjectHeader((KSOBJECT_HEADER*)&Allocator->Header, 0, NULL, Irp, &DispatchTable);
|
Status = KsAllocateObjectHeader((KSOBJECT_HEADER*)&Allocator->Header, 0, NULL, Irp, &DispatchTable);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
FreeItem(Allocator);
|
FreeItem(AllocatorFraming);
|
||||||
return Status;
|
FreeItem(Allocator);
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set allocator type in object header */
|
/* set allocator type in object header */
|
||||||
|
@ -652,6 +659,7 @@ KsCreateDefaultAllocatorEx(
|
||||||
|
|
||||||
/* backup allocator framing */
|
/* backup allocator framing */
|
||||||
RtlMoveMemory(&Allocator->Status.Framing, AllocatorFraming, sizeof(KSALLOCATOR_FRAMING));
|
RtlMoveMemory(&Allocator->Status.Framing, AllocatorFraming, sizeof(KSALLOCATOR_FRAMING));
|
||||||
|
FreeItem(AllocatorFraming);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue