[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

svn path=/trunk/; revision=49356
This commit is contained in:
Johannes Anderwald 2010-10-30 15:40:54 +00:00
parent 92563c84b9
commit 951c6f7fa3
2 changed files with 39 additions and 1 deletions

View file

@ -293,6 +293,7 @@ CIrpQueue::UpdateMapping(
{
PKSSTREAM_HEADER StreamHeader;
ULONG Size, NumData, Index;
PMDL CurMdl, NextMdl;
if (!m_Irp)
{
@ -385,13 +386,50 @@ CIrpQueue::UpdateMapping(
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;
}
}

View file

@ -251,7 +251,7 @@ CPortTopology::Init(
// create the subdevice descriptor
Status = PcCreateSubdeviceDescriptor(&m_SubDeviceDescriptor,
2,
InterfaceGuids,
InterfaceGuids,
0,
NULL,
2,