sanitizing_allocator: fix zeroing memory when sizeof(T)>1

std::allocator<>::deallocate() second parameter is number of elements,
not array size!

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2023-11-07 08:50:04 +01:00
parent b39aecb224
commit 16df7b86a1

View File

@ -1951,11 +1951,11 @@ namespace winstd
/// ///
/// Deallocate object at _Ptr sanitizing its content first /// Deallocate object at _Ptr sanitizing its content first
/// ///
void deallocate(_In_ pointer _Ptr, _In_ size_type _Size) void deallocate(_In_ pointer _Ptr, _In_ size_type _Count)
{ {
// Sanitize then free. // Sanitize then free.
SecureZeroMemory(_Ptr, _Size); SecureZeroMemory(_Ptr, sizeof(_Ty) * _Count);
_Mybase::deallocate(_Ptr, _Size); _Mybase::deallocate(_Ptr, _Count);
} }
}; };