mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-03 04:13:31 +00:00
[PORTCLS] Zero memory in operator new. CORE-16157
Fixes a regression from 99fa38809f, which
replaced the kcom.h/stdunk.h versions (which zero memory) with local
implementations (which don't).
Standard C++ does not guarantee that memory is zeroed but several classes
rely on this, in particular for their m_Ref and m_bInitialized members.
Ideally the constructors should be fixed to initialize all required members,
but that task is error-prone so for now we simply restore the previous
behavior.
This commit is contained in:
@@ -24,7 +24,10 @@ public:
|
||||
POOL_TYPE PoolType,
|
||||
ULONG Tag)
|
||||
{
|
||||
return ExAllocatePoolWithTag(PoolType, Size, Tag);
|
||||
PVOID P = ExAllocatePoolWithTag(PoolType, Size, Tag);
|
||||
if (P)
|
||||
RtlZeroMemory(P, Size);
|
||||
return P;
|
||||
}
|
||||
|
||||
STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
|
||||
|
||||
@@ -21,7 +21,10 @@ operator new(
|
||||
POOL_TYPE PoolType,
|
||||
ULONG Tag)
|
||||
{
|
||||
return ExAllocatePoolWithTag(PoolType, Size, Tag);
|
||||
PVOID P = ExAllocatePoolWithTag(PoolType, Size, Tag);
|
||||
if (P)
|
||||
RtlZeroMemory(P, Size);
|
||||
return P;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -25,7 +25,10 @@ public:
|
||||
POOL_TYPE PoolType,
|
||||
ULONG Tag)
|
||||
{
|
||||
return ExAllocatePoolWithTag(PoolType, Size, Tag);
|
||||
PVOID P = ExAllocatePoolWithTag(PoolType, Size, Tag);
|
||||
if (P)
|
||||
RtlZeroMemory(P, Size);
|
||||
return P;
|
||||
}
|
||||
|
||||
STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
|
||||
|
||||
Reference in New Issue
Block a user