mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +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:
parent
595ae4c551
commit
76e00fab7e
3 changed files with 12 additions and 3 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue