https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ec1eb52ebf3cf8ff62a0e…
commit ec1eb52ebf3cf8ff62a0e1ea8f9dfa1e7b6c33dd
Author: Thomas Faber <thomas.faber(a)reactos.org>
AuthorDate: Sun Jan 16 23:02:39 2022 -0500
Commit: Thomas Faber <thomas.faber(a)reactos.org>
CommitDate: Tue Feb 15 08:43:05 2022 -0500
[PORTCLS] Do not rely on operator new to zero memory.
The standard operator new does not do this, and GCC will in fact
optimize out any zeroing done in the operator.
---
drivers/wdm/audio/backpln/portcls/dma_slave.cpp | 24 +++++++++++----
.../wdm/audio/backpln/portcls/pin_wavecyclic.cpp | 35 ++++++++++++++++++----
2 files changed, 49 insertions(+), 10 deletions(-)
diff --git a/drivers/wdm/audio/backpln/portcls/dma_slave.cpp
b/drivers/wdm/audio/backpln/portcls/dma_slave.cpp
index 4a0553b3ba8..40d5132f6f4 100644
--- a/drivers/wdm/audio/backpln/portcls/dma_slave.cpp
+++ b/drivers/wdm/audio/backpln/portcls/dma_slave.cpp
@@ -24,10 +24,7 @@ public:
POOL_TYPE PoolType,
ULONG Tag)
{
- PVOID P = ExAllocatePoolWithTag(PoolType, Size, Tag);
- if (P)
- RtlZeroMemory(P, Size);
- return P;
+ return ExAllocatePoolWithTag(PoolType, Size, Tag);
}
STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
@@ -49,7 +46,24 @@ public:
return m_Ref;
}
IMP_IDmaChannelInit;
- CDmaChannelInit(IUnknown * OuterUnknown){}
+ CDmaChannelInit(IUnknown * OuterUnknown) :
+ m_pDeviceObject(nullptr),
+ m_pAdapter(nullptr),
+ m_DmaStarted(FALSE),
+ m_MapSize(0),
+ m_MapRegisterBase(nullptr),
+ m_LastTransferCount(0),
+ m_MaximumBufferSize(0),
+ m_MaxMapRegisters(0),
+ m_AllocatedBufferSize(0),
+ m_BufferSize(0),
+ m_Address({0}),
+ m_Buffer(nullptr),
+ m_Mdl(nullptr),
+ m_WriteToDevice(FALSE),
+ m_Ref(0)
+ {
+ }
virtual ~CDmaChannelInit(){}
protected:
diff --git a/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.cpp
b/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.cpp
index 56eba19a438..07451f6190a 100644
--- a/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.cpp
+++ b/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.cpp
@@ -25,10 +25,7 @@ public:
POOL_TYPE PoolType,
ULONG Tag)
{
- PVOID P = ExAllocatePoolWithTag(PoolType, Size, Tag);
- if (P)
- RtlZeroMemory(P, Size);
- return P;
+ return ExAllocatePoolWithTag(PoolType, Size, Tag);
}
STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
@@ -51,7 +48,35 @@ public:
}
IMP_IPortPinWaveCyclic;
IMP_IServiceSink;
- CPortPinWaveCyclic(IUnknown *OuterUnknown){}
+ CPortPinWaveCyclic(IUnknown *OuterUnknown) :
+ m_Port(nullptr),
+ m_Filter(nullptr),
+ m_KsPinDescriptor(nullptr),
+ m_Miniport(nullptr),
+ m_ServiceGroup(nullptr),
+ m_DmaChannel(nullptr),
+ m_Stream(nullptr),
+ m_State(KSSTATE_STOP),
+ m_Format(nullptr),
+ m_ConnectDetails(nullptr),
+ m_CommonBuffer(nullptr),
+ m_CommonBufferSize(0),
+ m_CommonBufferOffset(0),
+ m_IrpQueue(nullptr),
+ m_FrameSize(0),
+ m_Capture(FALSE),
+ m_TotalPackets(0),
+ m_StopCount(0),
+ m_Position({0}),
+ m_AllocatorFraming({{0}}),
+ m_Descriptor(nullptr),
+ m_EventListLock(0),
+ m_EventList({nullptr}),
+ m_ResetState(KSRESET_BEGIN),
+ m_Delay(0),
+ m_Ref(0)
+ {
+ }
virtual ~CPortPinWaveCyclic(){}
protected: