Author: janderwald
Date: Sat Oct 22 12:34:03 2016
New Revision: 73020
URL:
http://svn.reactos.org/svn/reactos?rev=73020&view=rev
Log:
[USBAUDIO]
- fix warnings & leaks based on Thomas feedback
Modified:
trunk/reactos/drivers/usb/usbaudio/filter.c
trunk/reactos/drivers/usb/usbaudio/pin.c
Modified: trunk/reactos/drivers/usb/usbaudio/filter.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbaudio/filte…
==============================================================================
--- trunk/reactos/drivers/usb/usbaudio/filter.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbaudio/filter.c [iso-8859-1] Sat Oct 22 12:34:03 2016
@@ -1083,6 +1083,11 @@
/* store result */
*OutDescriptor = Descriptor;
}
+ else
+ {
+ /* failed */
+ FreeFunction(Descriptor);
+ }
/* done */
return Status;
@@ -1098,7 +1103,6 @@
OUT PVOID *OutDescriptor)
{
NTSTATUS Status;
- PUSB_STRING_DESCRIPTOR StringDescriptor;
/* retrieve descriptor */
Status = USBAudioGetDescriptor(DeviceObject, USB_STRING_DESCRIPTOR_TYPE,
DescriptorLength, DescriptorIndex, LanguageId, OutDescriptor);
@@ -1124,14 +1128,14 @@
RtlInitUnicodeString(&DestinationString,
L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\MediaCategories\\");
/* initialize object attributes */
- InitializeObjectAttributes(&ObjectAttributes, &DestinationString,
OBJ_CASE_INSENSITIVE | OBJ_OPENIF, NULL, NULL);
+ InitializeObjectAttributes(&ObjectAttributes, &DestinationString,
OBJ_CASE_INSENSITIVE | OBJ_OPENIF | OBJ_KERNEL_HANDLE, NULL, NULL);
/* create the key */
Status = ZwOpenKey(&Handle, KEY_ALL_ACCESS, &ObjectAttributes);
if (NT_SUCCESS(Status))
{
/* initialize object attributes */
- InitializeObjectAttributes(&ObjectAttributes, Name, OBJ_CASE_INSENSITIVE,
Handle, NULL);
+ InitializeObjectAttributes(&ObjectAttributes, Name, OBJ_CASE_INSENSITIVE |
OBJ_KERNEL_HANDLE, Handle, NULL);
Status = ZwCreateKey(OutHandle, KEY_ALL_ACCESS, &ObjectAttributes, 0, NULL,
0, NULL);
ZwClose(Handle);
@@ -1228,8 +1232,8 @@
if (!NT_SUCCESS(Status))
{
/* failed*/
- //FreeFunction(ComponentId);
- //return Status;
+ FreeFunction(ComponentId);
+ return Status;
}
FilterDescriptor->ComponentId = ComponentId;
@@ -1247,8 +1251,8 @@
if (!NT_SUCCESS(Status))
{
/* failed*/
- //FreeFunction(ComponentId);
- //return Status;
+ FreeFunction(ComponentId);
+ return Status;
}
/* lets create the filter */
Modified: trunk/reactos/drivers/usb/usbaudio/pin.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbaudio/pin.c…
==============================================================================
--- trunk/reactos/drivers/usb/usbaudio/pin.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbaudio/pin.c [iso-8859-1] Sat Oct 22 12:34:03 2016
@@ -789,7 +789,6 @@
PPIN_CONTEXT PinContext;
PLIST_ENTRY CurEntry;
PIRP Irp;
- PIO_STACK_LOCATION IoStack;
PURB Urb;
PUCHAR TransferBuffer, OutBuffer;
ULONG Offset, Length;
@@ -827,7 +826,6 @@
Irp = (PIRP)CONTAINING_RECORD(CurEntry, IRP, Tail.Overlay.ListEntry);
/* get urb from irp */
- IoStack = IoGetNextIrpStackLocation(Irp);
Urb = (PURB)Irp->Tail.Overlay.DriverContext[0];
ASSERT(Urb);
@@ -882,6 +880,7 @@
else
{
Status = KsStreamPointerAdvanceOffsets(LeadingStreamPointer, 0, Length,
FALSE);
+ NT_ASSERT(NT_SUCCESS(Status));
ASSERT(Length == Urb->UrbIsochronousTransfer.TransferBufferLength -
Offset);
}
@@ -1102,7 +1101,7 @@
}
/* get pin descriptor */
- PinDescriptor = &Filter->Descriptor->PinDescriptors[Pin->PinId];
+ PinDescriptor =
(PKSPIN_DESCRIPTOR_EX)&Filter->Descriptor->PinDescriptors[Pin->PinId];
*DataSize = sizeof(KSDATAFORMAT_WAVEFORMATEX);
if (DataBufferSize == 0)