[USBAUDIO]

- fix warnings & leaks based on Thomas feedback

svn path=/trunk/; revision=73020
This commit is contained in:
Johannes Anderwald 2016-10-22 12:34:03 +00:00
parent d0b74180b2
commit 5dc6c5bb88
2 changed files with 13 additions and 10 deletions

View file

@ -1083,6 +1083,11 @@ USBAudioGetDescriptor(
/* store result */
*OutDescriptor = Descriptor;
}
else
{
/* failed */
FreeFunction(Descriptor);
}
/* done */
return Status;
@ -1098,7 +1103,6 @@ USBAudioGetStringDescriptor(
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 @@ USBAudioRegCreateMediaCategoriesKey(
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 @@ USBAudioCreateFilterContext(
if (!NT_SUCCESS(Status))
{
/* failed*/
//FreeFunction(ComponentId);
//return Status;
FreeFunction(ComponentId);
return Status;
}
FilterDescriptor->ComponentId = ComponentId;
@ -1247,8 +1251,8 @@ USBAudioCreateFilterContext(
if (!NT_SUCCESS(Status))
{
/* failed*/
//FreeFunction(ComponentId);
//return Status;
FreeFunction(ComponentId);
return Status;
}
/* lets create the filter */

View file

@ -789,7 +789,6 @@ PinCaptureProcess(
PPIN_CONTEXT PinContext;
PLIST_ENTRY CurEntry;
PIRP Irp;
PIO_STACK_LOCATION IoStack;
PURB Urb;
PUCHAR TransferBuffer, OutBuffer;
ULONG Offset, Length;
@ -827,7 +826,6 @@ PinCaptureProcess(
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 @@ PinCaptureProcess(
else
{
Status = KsStreamPointerAdvanceOffsets(LeadingStreamPointer, 0, Length, FALSE);
NT_ASSERT(NT_SUCCESS(Status));
ASSERT(Length == Urb->UrbIsochronousTransfer.TransferBufferLength - Offset);
}
@ -1102,7 +1101,7 @@ UsbAudioPinDataIntersect(
}
/* 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)