Author: tfaber
Date: Mon Feb 20 11:35:24 2017
New Revision: 73856
URL:
http://svn.reactos.org/svn/reactos?rev=73856&view=rev
Log:
[KS]
- Avoid leaking AllocatorFraming in KsCreateDefaultAllocatorEx. Patch by Sebastian
Gasiorek
CORE-12797 #resolve
Modified:
trunk/reactos/drivers/ksfilter/ks/allocators.c
Modified: trunk/reactos/drivers/ksfilter/ks/allocators.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/alloca…
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/allocators.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/allocators.c [iso-8859-1] Mon Feb 20 11:35:24 2017
@@ -593,20 +593,27 @@
/* 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 @@
/* backup allocator framing */
RtlMoveMemory(&Allocator->Status.Framing, AllocatorFraming,
sizeof(KSALLOCATOR_FRAMING));
+ FreeItem(AllocatorFraming);
return Status;
}