- Silence a few debug prints
authorJohannes Anderwald <johannes.anderwald@reactos.org>
Sun, 19 Apr 2009 22:01:57 +0000 (22:01 +0000)
committerJohannes Anderwald <johannes.anderwald@reactos.org>
Sun, 19 Apr 2009 22:01:57 +0000 (22:01 +0000)
- Fix memory leaks on failure

svn path=/trunk/; revision=40596

reactos/drivers/wdm/audio/sysaudio/control.c
reactos/drivers/wdm/audio/sysaudio/deviface.c
reactos/drivers/wdm/audio/sysaudio/dispatcher.c
reactos/drivers/wdm/audio/sysaudio/main.c
reactos/drivers/wdm/audio/sysaudio/pin.c

index 151740d..795cee8 100644 (file)
@@ -122,7 +122,7 @@ SetMixerInputOutputFormat(
 
     /* set the input format */
     PinRequest.PinId = 0;
-    //DPRINT1("InputFormat %p Size %u WaveFormatSize %u DataFormat %u WaveEx %u\n", InputFormat, InputFormat->FormatSize, sizeof(KSDATAFORMAT_WAVEFORMATEX), sizeof(KSDATAFORMAT), sizeof(WAVEFORMATEX));
+    DPRINT("InputFormat %p Size %u WaveFormatSize %u DataFormat %u WaveEx %u\n", InputFormat, InputFormat->FormatSize, sizeof(KSDATAFORMAT_WAVEFORMATEX), sizeof(KSDATAFORMAT), sizeof(WAVEFORMATEX));
     Status = KsSynchronousIoControlDevice(FileObject, KernelMode, IOCTL_KS_PROPERTY,
                                           (PVOID)&PinRequest,
                                            sizeof(KSP_PIN),
@@ -134,7 +134,7 @@ SetMixerInputOutputFormat(
 
     /* set the the output format */
     PinRequest.PinId = 1;
-    //DPRINT1("OutputFormat %p Size %u WaveFormatSize %u DataFormat %u WaveEx %u\n", OutputFormat, OutputFormat->FormatSize, sizeof(KSDATAFORMAT_WAVEFORMATEX), sizeof(KSDATAFORMAT), sizeof(WAVEFORMATEX));
+    DPRINT("OutputFormat %p Size %u WaveFormatSize %u DataFormat %u WaveEx %u\n", OutputFormat, OutputFormat->FormatSize, sizeof(KSDATAFORMAT_WAVEFORMATEX), sizeof(KSDATAFORMAT), sizeof(WAVEFORMATEX));
     Status = KsSynchronousIoControlDevice(FileObject, KernelMode, IOCTL_KS_PROPERTY,
                                           (PVOID)&PinRequest,
                                            sizeof(KSP_PIN),
index 5ebaf6b..db43df5 100644 (file)
@@ -41,12 +41,18 @@ FilterPinWorkerRoutine(
     Status = KsSynchronousIoControlDevice(DeviceEntry->FileObject, KernelMode, IOCTL_KS_PROPERTY, (PVOID)&PropertyRequest, sizeof(KSPROPERTY), (PVOID)&Count, sizeof(ULONG), &BytesReturned);
     if (!NT_SUCCESS(Status))
     {
+        ObDereferenceObject(DeviceEntry->FileObject);
+        ZwClose(DeviceEntry->Handle);
+        ExFreePool(DeviceEntry->DeviceName.Buffer);
         ExFreePool(DeviceEntry);
         return;
     }
 
     if (!Count)
     {
+        ObDereferenceObject(DeviceEntry->FileObject);
+        ZwClose(DeviceEntry->Handle);
+        ExFreePool(DeviceEntry->DeviceName.Buffer);
         ExFreePool(DeviceEntry);
         return;
     }
@@ -56,6 +62,9 @@ FilterPinWorkerRoutine(
     if (!DeviceEntry->Pins)
     {
         /* no memory */
+        ObDereferenceObject(DeviceEntry->FileObject);
+        ZwClose(DeviceEntry->Handle);
+        ExFreePool(DeviceEntry->DeviceName.Buffer);
         ExFreePool(DeviceEntry);
         return;
     }
@@ -101,7 +110,7 @@ FilterPinWorkerRoutine(
 
     }
 
-    DPRINT1("Num Pins %u Num WaveIn Pins %u Name WaveOut Pins %u\n", DeviceEntry->NumberOfPins, DeviceEntry->NumWaveInPin, DeviceEntry->NumWaveOutPin);
+    DPRINT("Num Pins %u Num WaveIn Pins %u Name WaveOut Pins %u\n", DeviceEntry->NumberOfPins, DeviceEntry->NumWaveInPin, DeviceEntry->NumWaveOutPin);
 
     DeviceExtension = (PSYSAUDIODEVEXT)DeviceObject->DeviceExtension;
 
@@ -139,7 +148,7 @@ OpenDevice(
 
     if (!NT_SUCCESS(Status))
     {
-        DPRINT1("ZwCreateFile failed with %x\n", Status);
+        DPRINT("ZwCreateFile failed with %x\n", Status);
         return Status;
     }
 
@@ -147,7 +156,7 @@ OpenDevice(
     if (!NT_SUCCESS(Status))
     {
         ZwClose(NodeHandle);
-        DPRINT1("ObReferenceObjectByHandle failed with %x\n", Status);
+        DPRINT("ObReferenceObjectByHandle failed with %x\n", Status);
         return Status;
     }
 
@@ -210,12 +219,13 @@ DeviceInterfaceChangeCallback(
         Status = OpenDevice(&DeviceEntry->DeviceName, &DeviceEntry->Handle, &DeviceEntry->FileObject);
         if (!NT_SUCCESS(Status))
         {
-            DPRINT1("ZwCreateFile failed with %x\n", Status);
+            DPRINT("ZwCreateFile failed with %x\n", Status);
+            ExFreePool(DeviceEntry->DeviceName.Buffer);
             ExFreePool(DeviceEntry);
             return Status;
         }
 
-        DPRINT1("Successfully opened audio device %u handle %p file object %p device object %p\n", DeviceExtension->NumberOfKsAudioDevices, DeviceEntry->Handle, DeviceEntry->FileObject, DeviceEntry->FileObject->DeviceObject);
+        DPRINT("Successfully opened audio device %u handle %p file object %p device object %p\n", DeviceExtension->NumberOfKsAudioDevices, DeviceEntry->Handle, DeviceEntry->FileObject, DeviceEntry->FileObject->DeviceObject);
 
         //FIXME
         // mutal exclusion
@@ -224,7 +234,7 @@ DeviceInterfaceChangeCallback(
     }
     else
     {
-        DPRINT1("Remove interface to audio device!\n");
+        DPRINT("Remove interface to audio device!\n");
         UNIMPLEMENTED
         return STATUS_SUCCESS;
     }
@@ -250,7 +260,7 @@ SysAudioRegisterNotifications(
 
     if (!NT_SUCCESS(Status))
     {
-        DPRINT1("IoRegisterPlugPlayNotification failed with %x\n", Status);
+        DPRINT("IoRegisterPlugPlayNotification failed with %x\n", Status);
     }
 
     Status = IoRegisterPlugPlayNotification(EventCategoryDeviceInterfaceChange,
@@ -264,7 +274,7 @@ SysAudioRegisterNotifications(
     if (!NT_SUCCESS(Status))
     {
         /* ignore failure for now */
-        DPRINT1("IoRegisterPlugPlayNotification failed for DMOCATEGORY_ACOUSTIC_ECHO_CANCEL\n", Status);
+        DPRINT("IoRegisterPlugPlayNotification failed for DMOCATEGORY_ACOUSTIC_ECHO_CANCEL\n", Status);
     }
 
     return STATUS_SUCCESS;
@@ -287,7 +297,7 @@ SysAudioRegisterDeviceInterfaces(
     }
     else
     {
-        DPRINT1("Failed to register KSCATEGORY_PREFERRED_MIDIOUT_DEVICE interface Status %x\n", Status);
+        DPRINT("Failed to register KSCATEGORY_PREFERRED_MIDIOUT_DEVICE interface Status %x\n", Status);
         return Status;
     }
 
@@ -299,7 +309,7 @@ SysAudioRegisterDeviceInterfaces(
     }
     else
     {
-        DPRINT1("Failed to register KSCATEGORY_PREFERRED_WAVEIN_DEVICE interface Status %x\n", Status);
+        DPRINT("Failed to register KSCATEGORY_PREFERRED_WAVEIN_DEVICE interface Status %x\n", Status);
         return Status;
     }
 
@@ -311,7 +321,7 @@ SysAudioRegisterDeviceInterfaces(
     }
     else
     {
-        DPRINT1("Failed to register KSCATEGORY_PREFERRED_WAVEOUT_DEVICE interface Status %x\n", Status);
+        DPRINT("Failed to register KSCATEGORY_PREFERRED_WAVEOUT_DEVICE interface Status %x\n", Status);
     }
 
     Status = IoRegisterDeviceInterface(DeviceObject, &KSCATEGORY_SYSAUDIO, NULL, &SymbolicLink);
@@ -322,7 +332,7 @@ SysAudioRegisterDeviceInterfaces(
     }
     else
     {
-        DPRINT1("Failed to register KSCATEGORY_SYSAUDIO interface Status %x\n", Status);
+        DPRINT("Failed to register KSCATEGORY_SYSAUDIO interface Status %x\n", Status);
     }
 
     return Status;
index fb7700a..005d319 100644 (file)
@@ -128,7 +128,7 @@ Dispatch_fnClose(
 
                     ExFreePool(DispatchContext);
 
-                    //DPRINT1("Index %u DeviceIndex %u Pin %u References %u\n", Index, Client->Devs[Index].DeviceId, SubIndex, Entry->Pins[Client->Devs[Index].ClientHandles[SubIndex].PinId].References);
+                    DPRINT("Index %u DeviceIndex %u Pin %u References %u\n", Index, Client->Devs[Index].DeviceId, SubIndex, Entry->Pins[Client->Devs[Index].ClientHandles[SubIndex].PinId].References);
                     if (!Entry->Pins[Client->Devs[Index].ClientHandles[SubIndex].PinId].References)
                     {
                         DPRINT("Closing pin %p\n", Entry->Pins[Client->Devs[Index].ClientHandles[SubIndex].PinId].PinHandle);
@@ -159,7 +159,7 @@ Dispatch_fnQuerySecurity(
     PDEVICE_OBJECT DeviceObject,
     PIRP Irp)
 {
-    DPRINT1("Dispatch_fnQuerySecurity called DeviceObject %p Irp %p\n", DeviceObject);
+    DPRINT("Dispatch_fnQuerySecurity called DeviceObject %p Irp %p\n", DeviceObject);
 
     Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
     Irp->IoStatus.Information = 0;
@@ -174,7 +174,7 @@ Dispatch_fnSetSecurity(
     PIRP Irp)
 {
 
-    DPRINT1("Dispatch_fnSetSecurity called DeviceObject %p Irp %p\n", DeviceObject);
+    DPRINT("Dispatch_fnSetSecurity called DeviceObject %p Irp %p\n", DeviceObject);
 
     Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
     Irp->IoStatus.Information = 0;
@@ -195,7 +195,7 @@ Dispatch_fnFastDeviceIoControl(
     PIO_STATUS_BLOCK IoStatus,
     PDEVICE_OBJECT DeviceObject)
 {
-    DPRINT1("Dispatch_fnFastDeviceIoControl called DeviceObject %p Irp %p\n", DeviceObject);
+    DPRINT("Dispatch_fnFastDeviceIoControl called DeviceObject %p Irp %p\n", DeviceObject);
 
 
     return FALSE;
@@ -214,7 +214,7 @@ Dispatch_fnFastRead(
     PIO_STATUS_BLOCK IoStatus,
     PDEVICE_OBJECT DeviceObject)
 {
-    DPRINT1("Dispatch_fnFastRead called DeviceObject %p Irp %p\n", DeviceObject);
+    DPRINT("Dispatch_fnFastRead called DeviceObject %p Irp %p\n", DeviceObject);
 
     return FALSE;
 
@@ -232,7 +232,7 @@ Dispatch_fnFastWrite(
     PIO_STATUS_BLOCK IoStatus,
     PDEVICE_OBJECT DeviceObject)
 {
-    DPRINT1("Dispatch_fnFastWrite called DeviceObject %p Irp %p\n", DeviceObject);
+    DPRINT("Dispatch_fnFastWrite called DeviceObject %p Irp %p\n", DeviceObject);
 
     return FALSE;
 }
@@ -353,7 +353,7 @@ DispatchCreateSysAudio(
     /* allocate object header */
     Status = KsAllocateObjectHeader(&ObjectHeader, 1, CreateItem, Irp, &DispatchTable);
 
-    DPRINT1("KsAllocateObjectHeader result %x\n", Status);
+    DPRINT("KsAllocateObjectHeader result %x\n", Status);
     /* complete the irp */
     Irp->IoStatus.Information = 0;
     Irp->IoStatus.Status = Status;
index 93d3098..0b9d92d 100644 (file)
@@ -24,7 +24,7 @@ VOID
 NTAPI
 SysAudio_Unload(IN PDRIVER_OBJECT DriverObject)
 {
-    DPRINT1("SysAudio_Unload called\n");
+    DPRINT("SysAudio_Unload called\n");
 }
 
 NTSTATUS
@@ -79,7 +79,7 @@ SysAudio_InstallDevice(
     SYSAUDIODEVEXT *DeviceExtension;
 
 
-    DPRINT1("SysAudio_InstallDevice called\n");
+    DPRINT("SysAudio_InstallDevice called\n");
 
     /* Create the device */
     Status = IoCreateDevice(DriverObject,
@@ -191,7 +191,7 @@ DriverEntry(
     IN  PDRIVER_OBJECT DriverObject,
     IN  PUNICODE_STRING RegistryPath)
 {
-    DPRINT1("System audio graph builder (sysaudio) started\n");
+    DPRINT("System audio graph builder (sysaudio) started\n");
 
     /* Let ks handle these */
     KsSetMajorFunctionHandler(DriverObject, IRP_MJ_CREATE);
index 8a46221..5127b9c 100644 (file)
@@ -206,7 +206,7 @@ Pin_fnClose(
     PDEVICE_OBJECT DeviceObject,
     PIRP Irp)
 {
-    DPRINT1("Pin_fnClose called DeviceObject %p Irp %p\n", DeviceObject);
+    DPRINT("Pin_fnClose called DeviceObject %p Irp %p\n", DeviceObject);
 
     Irp->IoStatus.Status = STATUS_SUCCESS;
     Irp->IoStatus.Information = 0;
@@ -220,7 +220,7 @@ Pin_fnQuerySecurity(
     PDEVICE_OBJECT DeviceObject,
     PIRP Irp)
 {
-    DPRINT1("Pin_fnQuerySecurity called DeviceObject %p Irp %p\n", DeviceObject);
+    DPRINT("Pin_fnQuerySecurity called DeviceObject %p Irp %p\n", DeviceObject);
 
     Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
     Irp->IoStatus.Information = 0;
@@ -235,7 +235,7 @@ Pin_fnSetSecurity(
     PIRP Irp)
 {
 
-    DPRINT1("Pin_fnSetSecurity called DeviceObject %p Irp %p\n", DeviceObject);
+    DPRINT("Pin_fnSetSecurity called DeviceObject %p Irp %p\n", DeviceObject);
 
     Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
     Irp->IoStatus.Information = 0;
@@ -256,7 +256,7 @@ Pin_fnFastDeviceIoControl(
     PIO_STATUS_BLOCK IoStatus,
     PDEVICE_OBJECT DeviceObject)
 {
-    DPRINT1("Pin_fnFastDeviceIoControl called DeviceObject %p Irp %p\n", DeviceObject);
+    DPRINT("Pin_fnFastDeviceIoControl called DeviceObject %p Irp %p\n", DeviceObject);
 
 
     return FALSE;
@@ -275,7 +275,7 @@ Pin_fnFastRead(
     PIO_STATUS_BLOCK IoStatus,
     PDEVICE_OBJECT DeviceObject)
 {
-    DPRINT1("Pin_fnFastRead called DeviceObject %p Irp %p\n", DeviceObject);
+    DPRINT("Pin_fnFastRead called DeviceObject %p Irp %p\n", DeviceObject);
 
     return FALSE;
 
@@ -296,7 +296,7 @@ Pin_fnFastWrite(
     PDISPATCH_CONTEXT Context;
     NTSTATUS Status;
 
-    //DPRINT1("Pin_fnFastWrite called DeviceObject %p Irp %p\n", DeviceObject);
+    DPRINT("Pin_fnFastWrite called DeviceObject %p Irp %p\n", DeviceObject);
 
     Context = (PDISPATCH_CONTEXT)FileObject->FsContext2;