Author: janderwald
Date: Wed Jun 9 14:44:46 2010
New Revision: 47714
URL:
http://svn.reactos.org/svn/reactos?rev=47714&view=rev
Log:
[KS]
- Perform all allocations / frees in dedicated alloc / free function
Modified:
trunk/reactos/drivers/ksfilter/ks/api.c
trunk/reactos/drivers/ksfilter/ks/connectivity.c
trunk/reactos/drivers/ksfilter/ks/event.c
trunk/reactos/drivers/ksfilter/ks/image.c
trunk/reactos/drivers/ksfilter/ks/irp.c
trunk/reactos/drivers/ksfilter/ks/misc.c
trunk/reactos/drivers/ksfilter/ks/pin.c
trunk/reactos/drivers/ksfilter/ks/topology.c
Modified: trunk/reactos/drivers/ksfilter/ks/api.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/api.c?…
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/api.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/api.c [iso-8859-1] Wed Jun 9 14:44:46 2010
@@ -530,7 +530,7 @@
return STATUS_INVALID_PARAMETER;
/* allocate a device header */
- Header = ExAllocatePoolWithTag(PagedPool, sizeof(KSIDEVICE_HEADER),
TAG_DEVICE_HEADER);
+ Header = AllocateItem(PagedPool, sizeof(KSIDEVICE_HEADER));
/* check for success */
if (!Header)
@@ -597,7 +597,7 @@
return;
KspFreeCreateItems(&Header->ItemList);
- ExFreePoolWithTag(Header, TAG_DEVICE_HEADER);
+ FreeItem(Header);
}
/*
@@ -641,7 +641,7 @@
/* check for an file object */
/* allocate the object header */
- ObjectHeader = ExAllocatePoolWithTag(NonPagedPool, sizeof(KSIOBJECT_HEADER),
TAG_DEVICE_HEADER);
+ ObjectHeader = AllocateItem(NonPagedPool, sizeof(KSIOBJECT_HEADER));
if (!ObjectHeader)
return STATUS_INSUFFICIENT_RESOURCES;
@@ -659,10 +659,10 @@
{
/* copy object class */
ObjectHeader->ObjectClass.MaximumLength =
IoStack->FileObject->FileName.MaximumLength;
- ObjectHeader->ObjectClass.Buffer = ExAllocatePoolWithTag(NonPagedPool,
ObjectHeader->ObjectClass.MaximumLength, TAG_DEVICE_HEADER);
+ ObjectHeader->ObjectClass.Buffer = AllocateItem(NonPagedPool,
ObjectHeader->ObjectClass.MaximumLength);
if (!ObjectHeader->ObjectClass.Buffer)
{
- ExFreePoolWithTag(ObjectHeader, TAG_DEVICE_HEADER);
+ FreeItem(ObjectHeader);
return STATUS_INSUFFICIENT_RESOURCES;
}
RtlCopyUnicodeString(&ObjectHeader->ObjectClass,
&IoStack->FileObject->FileName);
@@ -726,7 +726,7 @@
if (ObjectHeader->ObjectClass.Buffer)
{
/* release object class buffer */
- ExFreePoolWithTag(ObjectHeader->ObjectClass.Buffer, TAG_DEVICE_HEADER);
+ FreeItem(ObjectHeader->ObjectClass.Buffer);
}
if (ObjectHeader->Unknown)
@@ -739,7 +739,7 @@
KspFreeCreateItems(&ObjectHeader->ItemList);
/* free object header */
- ExFreePoolWithTag(ObjectHeader, TAG_DEVICE_HEADER);
+ FreeItem(ObjectHeader);
}
@@ -914,11 +914,11 @@
if (AllocateEntry)
{
/* allocate create item */
- Item = ExAllocatePool(NonPagedPool, sizeof(KSOBJECT_CREATE_ITEM));
+ Item = AllocateItem(NonPagedPool, sizeof(KSOBJECT_CREATE_ITEM));
if (!Item)
{
/* no memory */
- ExFreePool(CreateEntry);
+ FreeItem(CreateEntry);
return STATUS_INSUFFICIENT_RESOURCES;
}
@@ -931,7 +931,7 @@
Item->ObjectClass.MaximumLength = CreateItem->ObjectClass.MaximumLength;
/* copy object class */
- Item->ObjectClass.Buffer = ExAllocatePool(NonPagedPool,
Item->ObjectClass.MaximumLength);
+ Item->ObjectClass.Buffer = AllocateItem(NonPagedPool,
Item->ObjectClass.MaximumLength);
if (!Item->ObjectClass.Buffer)
{
/* release resources */
@@ -1747,7 +1747,7 @@
Length = wcslen(BusIdentifier) * sizeof(WCHAR);
Length += sizeof(BUS_ENUM_DEVICE_EXTENSION);
- BusDeviceExtension = ExAllocatePool(NonPagedPool, Length);
+ BusDeviceExtension = AllocateItem(NonPagedPool, Length);
if (!BusDeviceExtension)
{
/* not enough memory */
@@ -1772,12 +1772,12 @@
BusDeviceExtension->ServicePath.Length = 0;
BusDeviceExtension->ServicePath.MaximumLength = Length;
- BusDeviceExtension->ServicePath.Buffer = ExAllocatePool(NonPagedPool, Length);
+ BusDeviceExtension->ServicePath.Buffer = AllocateItem(NonPagedPool, Length);
if (!BusDeviceExtension->ServicePath.Buffer)
{
/* not enough memory */
- ExFreePool(BusDeviceExtension);
+ FreeItem(BusDeviceExtension);
return STATUS_INSUFFICIENT_RESOURCES;
}
@@ -1798,8 +1798,8 @@
/* check for success */
if (!NT_SUCCESS(Status))
{
- ExFreePool(BusDeviceExtension->ServicePath.Buffer);
- ExFreePool(BusDeviceExtension);
+ FreeItem(BusDeviceExtension->ServicePath.Buffer);
+ FreeItem(BusDeviceExtension);
return Status;
}
@@ -1808,8 +1808,8 @@
if (!NT_SUCCESS(Status))
{
- ExFreePool(BusDeviceExtension->ServicePath.Buffer);
- ExFreePool(BusDeviceExtension);
+ FreeItem(BusDeviceExtension->ServicePath.Buffer);
+ FreeItem(BusDeviceExtension);
return Status;
}
@@ -1836,8 +1836,8 @@
}
/* free device extension */
- ExFreePool(BusDeviceExtension->ServicePath.Buffer);
- ExFreePool(BusDeviceExtension);
+ FreeItem(BusDeviceExtension->ServicePath.Buffer);
+ FreeItem(BusDeviceExtension);
return STATUS_DEVICE_REMOVED;
}
@@ -2795,7 +2795,7 @@
}
/* free the symbolic link list */
- ExFreePool(SymbolicLinkList);
+ FreeItem(SymbolicLinkList);
}
return Status;
Modified: trunk/reactos/drivers/ksfilter/ks/connectivity.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/connec…
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/connectivity.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/connectivity.c [iso-8859-1] Wed Jun 9 14:44:46
2010
@@ -239,7 +239,7 @@
/* allocate buffer for the registry key */
Path.Length = 0;
Path.MaximumLength = MediaPath.MaximumLength + GuidString.MaximumLength;
- Path.Buffer = ExAllocatePool(NonPagedPool, Path.MaximumLength);
+ Path.Buffer = AllocateItem(NonPagedPool, Path.MaximumLength);
if (!Path.Buffer)
{
/* not enough memory */
@@ -262,7 +262,7 @@
DPRINT("ZwOpenKey() status 0x%08lx %S\n", Status, Path.Buffer);
/* free path buffer */
- ExFreePool(Path.Buffer);
+ FreeItem(Path.Buffer);
/* check for success */
if (!NT_SUCCESS(Status))
@@ -281,7 +281,7 @@
}
/* allocate buffer to read key info */
- KeyInfo = (PKEY_VALUE_PARTIAL_INFORMATION) ExAllocatePool(NonPagedPool, Size);
+ KeyInfo = (PKEY_VALUE_PARTIAL_INFORMATION) AllocateItem(NonPagedPool, Size);
if (!KeyInfo)
{
/* not enough memory */
@@ -298,7 +298,7 @@
if (!NT_SUCCESS(Status))
{
/* failed to read key */
- ExFreePool(KeyInfo);
+ FreeItem(KeyInfo);
return Status;
}
@@ -545,13 +545,13 @@
if (KeyInfo->DataLength + sizeof(WCHAR) >
IoStack->Parameters.DeviceIoControl.OutputBufferLength)
{
Status = STATUS_BUFFER_OVERFLOW;
- ExFreePool(KeyInfo);
+ FreeItem(KeyInfo);
break;
}
RtlMoveMemory(Irp->UserBuffer, &KeyInfo->Data,
KeyInfo->DataLength);
((LPWSTR)Irp->UserBuffer)[KeyInfo->DataLength / sizeof(WCHAR)] =
L'\0';
- ExFreePool(KeyInfo);
+ FreeItem(KeyInfo);
break;
case KSPROPERTY_PIN_PROPOSEDATAFORMAT:
Size = sizeof(KSDATAFORMAT);
Modified: trunk/reactos/drivers/ksfilter/ks/event.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/event.…
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/event.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/event.c [iso-8859-1] Wed Jun 9 14:44:46 2010
@@ -292,7 +292,7 @@
else
{
/* allocate it from nonpaged pool */
- EventEntry = ExAllocatePool(NonPagedPool, Size);
+ EventEntry = AllocateItem(NonPagedPool, Size);
}
if (!EventEntry)
@@ -529,7 +529,7 @@
}
/* free event entry */
- ExFreePool(EventEntry);
+ FreeItem(EventEntry);
}
Modified: trunk/reactos/drivers/ksfilter/ks/image.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/image.…
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/image.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/image.c [iso-8859-1] Wed Jun 9 14:44:46 2010
@@ -45,7 +45,7 @@
if (NT_SUCCESS(Status))
{
/* allocate resource buffer */
- Result = ExAllocatePool(PoolType, Size);
+ Result = AllocateItem(PoolType, Size);
if (Result)
{
/* copy resource */
@@ -75,7 +75,7 @@
if (Result)
{
/* free resource buffer in case of a failure */
- ExFreePool(Result);
+ FreeItem(Result);
}
}
/* done */
@@ -127,7 +127,7 @@
/* allocate image name buffer */
ImageName->MaximumLength = sizeof(ImagePath) + ImageLength;
- ImageName->Buffer = ExAllocatePool(PagedPool, ImageName->MaximumLength);
+ ImageName->Buffer = AllocateItem(PagedPool, ImageName->MaximumLength);
/* check for success */
if (!ImageName->Buffer)
@@ -145,7 +145,7 @@
if (!NT_SUCCESS(Status))
{
/* unexpected error */
- ExFreePool(ImageName->Buffer);
+ FreeItem(ImageName->Buffer);
return Status;
}
@@ -154,13 +154,13 @@
Status = KspQueryRegValue(RegKey, L"ResourceId", NULL, &ImageLength,
ValueType);
/* allocate resource id buffer*/
- *ResourceId = (ULONG_PTR)ExAllocatePool(PagedPool, ImageLength);
+ *ResourceId = (ULONG_PTR)AllocateItem(PagedPool, ImageLength);
/* check for success */
if (!*ResourceId)
{
/* insufficient memory */
- ExFreePool(ImageName->Buffer);
+ FreeItem(ImageName->Buffer);
return STATUS_INSUFFICIENT_RESOURCES;
}
/* now query for resource id */
@@ -169,8 +169,8 @@
if (!NT_SUCCESS(Status))
{
/* unexpected error */
- ExFreePool(ImageName->Buffer);
- ExFreePool((PVOID)*ResourceId);
+ FreeItem(ImageName->Buffer);
+ FreeItem((PVOID)*ResourceId);
}
/* return result */
@@ -209,7 +209,7 @@
/* initialize subkey buffer */
SubKeyName.Length = 0;
SubKeyName.MaximumLength = Modules.MaximumLength + ModuleName->MaximumLength;
- SubKeyName.Buffer = ExAllocatePool(PagedPool, SubKeyName.MaximumLength);
+ SubKeyName.Buffer = AllocateItem(PagedPool, SubKeyName.MaximumLength);
/* check for success */
if (!SubKeyName.Buffer)
@@ -240,7 +240,7 @@
}
/* free subkey string */
- ExFreePool(SubKeyName.Buffer);
+ FreeItem(SubKeyName.Buffer);
/* close device key */
ZwClose(hKey);
Modified: trunk/reactos/drivers/ksfilter/ks/irp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/irp.c?…
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/irp.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/irp.c [iso-8859-1] Wed Jun 9 14:44:46 2010
@@ -101,7 +101,7 @@
if (NT_SUCCESS(Status))
{
/* free old descriptor */
- ExFreePool(Descriptor);
+ FreeItem(Descriptor);
/* mark create item as changed */
CreateItem->Flags |= KSCREATE_ITEM_SECURITYCHANGED;
@@ -896,7 +896,7 @@
if (Length && ( (!HeaderSize) || (Length % HeaderSize == 0) || ((ProbeFlags
& KSPROBE_ALLOWFORMATCHANGE) && (Length == sizeof(KSSTREAM_HEADER))) ) )
{
/* allocate stream header buffer */
- Irp->AssociatedIrp.SystemBuffer = ExAllocatePool(NonPagedPool, Length);
+ Irp->AssociatedIrp.SystemBuffer = AllocateItem(NonPagedPool, Length);
if (!Irp->AssociatedIrp.SystemBuffer)
{
Modified: trunk/reactos/drivers/ksfilter/ks/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/misc.c…
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/misc.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/misc.c [iso-8859-1] Wed Jun 9 14:44:46 2010
@@ -26,7 +26,6 @@
FreeItem(
IN PVOID Item)
{
-
ExFreePool(Item);
}
Modified: trunk/reactos/drivers/ksfilter/ks/pin.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/pin.c?…
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/pin.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/pin.c [iso-8859-1] Wed Jun 9 14:44:46 2010
@@ -1560,7 +1560,7 @@
Size = sizeof(KSISTREAM_POINTER) + ContextSize;
/* allocate new stream pointer */
- NewFrame = (PKSISTREAM_POINTER)ExAllocatePool(NonPagedPool, Size);
+ NewFrame = (PKSISTREAM_POINTER)AllocateItem(NonPagedPool, Size);
if (!NewFrame)
return STATUS_INSUFFICIENT_RESOURCES;
Modified: trunk/reactos/drivers/ksfilter/ks/topology.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/topolo…
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/topology.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/topology.c [iso-8859-1] Wed Jun 9 14:44:46 2010
@@ -30,7 +30,7 @@
Name.MaximumLength = wcslen(ObjectType) * sizeof(WCHAR) + CreateParametersSize + 2 *
sizeof(WCHAR);
Name.MaximumLength += sizeof(WCHAR);
/* acquire request buffer */
- Name.Buffer = ExAllocatePool(NonPagedPool, Name.MaximumLength);
+ Name.Buffer = AllocateItem(NonPagedPool, Name.MaximumLength);
/* check for success */
if (!Name.Buffer)
{
@@ -68,7 +68,7 @@
IO_NO_PARAMETER_CHECKING | IO_FORCE_ACCESS_CHECK);
/* free request buffer */
- ExFreePool(Name.Buffer);
+ FreeItem(Name.Buffer);
return Status;
}
@@ -200,7 +200,7 @@
KeyName.Length = 0;
KeyName.MaximumLength = LocalMachine.Length + GuidString.Length +
sizeof(WCHAR);
- KeyName.Buffer = ExAllocatePool(PagedPool, KeyName.MaximumLength);
+ KeyName.Buffer = AllocateItem(PagedPool, KeyName.MaximumLength);
if (!KeyName.Buffer)
{
Irp->IoStatus.Information = 0;
@@ -217,7 +217,7 @@
InitializeObjectAttributes(&ObjectAttributes, &KeyName,
OBJ_CASE_INSENSITIVE, NULL, NULL);
Status = ZwOpenKey(&hKey, GENERIC_READ, &ObjectAttributes);
- ExFreePool(KeyName.Buffer);
+ FreeItem(KeyName.Buffer);
if (!NT_SUCCESS(Status))
{
@@ -235,7 +235,7 @@
}
ASSERT(Size);
- KeyInfo = (PKEY_VALUE_PARTIAL_INFORMATION) ExAllocatePool(NonPagedPool,
Size);
+ KeyInfo = (PKEY_VALUE_PARTIAL_INFORMATION) AllocateItem(NonPagedPool, Size);
if (!KeyInfo)
{
Status = STATUS_NO_MEMORY;
@@ -245,7 +245,7 @@
Status = ZwQueryValueKey(hKey, &Name, KeyValuePartialInformation,
(PVOID)KeyInfo, Size, &Size);
if (!NT_SUCCESS(Status))
{
- ExFreePool(KeyInfo);
+ FreeItem(KeyInfo);
ZwClose(hKey);
Irp->IoStatus.Information = 0;
break;
@@ -256,14 +256,14 @@
{
Irp->IoStatus.Information = KeyInfo->DataLength + sizeof(WCHAR);
Status = STATUS_MORE_ENTRIES;
- ExFreePool(KeyInfo);
+ FreeItem(KeyInfo);
break;
}
RtlMoveMemory(Irp->UserBuffer, &KeyInfo->Data,
KeyInfo->DataLength);
((LPWSTR)Irp->UserBuffer)[KeyInfo->DataLength / sizeof(WCHAR)] =
L'\0';
Irp->IoStatus.Information = KeyInfo->DataLength + sizeof(WCHAR);
- ExFreePool(KeyInfo);
+ FreeItem(KeyInfo);
break;
default:
Irp->IoStatus.Information = 0;