cleanse: Use SecureZeroMemory for mingw-w64 (release) builds

This commit is contained in:
fanquake 2023-01-20 17:09:24 +00:00
parent fa0b5d6882
commit c399c80a09
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1

View file

@ -7,14 +7,14 @@
#include <cstring>
#if defined(_MSC_VER)
#include <Windows.h> // For SecureZeroMemory.
#if defined(WIN32)
#include <windows.h>
#endif
void memory_cleanse(void *ptr, size_t len)
{
#if defined(_MSC_VER)
/* SecureZeroMemory is guaranteed not to be optimized out by MSVC. */
#if defined(WIN32)
/* SecureZeroMemory is guaranteed not to be optimized out. */
SecureZeroMemory(ptr, len);
#else
std::memset(ptr, 0, len);