Author: janderwald
Date: Sat Oct 30 15:40:54 2010
New Revision: 49356
URL:
http://svn.reactos.org/svn/reactos?rev=49356&view=rev
Log:
[PORTCLS]
- Do not leak KSSTREAM_HEADER (48 bytes) for each IOCTL_KS_WRITE_STREAM /
IOCTL_KS_READ_STREAM request
- Audio stack should now leak less memory
Modified:
trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.cpp
trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.cpp
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.cpp [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.cpp [iso-8859-1] Sat Oct 30
15:40:54 2010
@@ -293,6 +293,7 @@
{
PKSSTREAM_HEADER StreamHeader;
ULONG Size, NumData, Index;
+ PMDL CurMdl, NextMdl;
if (!m_Irp)
{
@@ -385,13 +386,50 @@
return;
}
+ // now free allocated mdls
+ CurMdl = m_Irp->MdlAddress;
+ for(Index = 0; Index < STREAMHEADER_COUNT(m_Irp); Index++)
+ {
+ // sanity check
+ ASSERT(CurMdl);
+
+ // get next mdl
+ NextMdl = CurMdl->Next;
+
+ // check if mdl is locked
+ if (CurMdl->MdlFlags & MDL_PAGES_LOCKED)
+ {
+ // unlock pages
+ MmUnlockPages(CurMdl);
+ }
+
+ // free mdl
+ IoFreeMdl(CurMdl);
+
+ // proceed to next mdl
+ CurMdl = NextMdl;
+ }
+
+ // all mdls have been freed now
+ m_Irp->MdlAddress = NULL;
+
+ // free allocated KSSTREAM_HEADER
+ ExFreePool(m_Irp->AssociatedIrp.SystemBuffer);
+
+ // is this really needed?
+ m_Irp->AssociatedIrp.SystemBuffer = NULL;
+
+ // store operation status
m_Irp->IoStatus.Status = STATUS_SUCCESS;
m_Irp->IoStatus.Information = NumData;
// complete the request
IoCompleteRequest(m_Irp, IO_SOUND_INCREMENT);
+
// remove irp as it is complete
m_Irp = NULL;
+
+ // reset offset
m_CurrentOffset = 0;
}
}
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.cpp [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.cpp [iso-8859-1] Sat Oct
30 15:40:54 2010
@@ -251,7 +251,7 @@
// create the subdevice descriptor
Status = PcCreateSubdeviceDescriptor(&m_SubDeviceDescriptor,
2,
- InterfaceGuids,
+ InterfaceGuids,
0,
NULL,
2,