X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fallocators.h;h=2d4ef97e74453e20a927f8832c71391048d01d58;hb=f2b467c8d7d761dd47e58ad9ed4d8ede92a24601;hp=31ab21b99b2f42ef1658189d0c2dfa41481c63d3;hpb=713fd8a57b0f2b5f8f8158542e51f1c51919eb32;p=novacoin.git diff --git a/src/allocators.h b/src/allocators.h index 31ab21b..2d4ef97 100644 --- a/src/allocators.h +++ b/src/allocators.h @@ -9,6 +9,7 @@ #include #include #include +#include // for OPENSSL_cleanse() #ifdef WIN32 #ifdef _WIN32_WINNT @@ -212,7 +213,7 @@ struct secure_allocator : public std::allocator { if (p != NULL) { - memset(p, 0, sizeof(T) * n); + OPENSSL_cleanse(p, sizeof(T) * n); LockedPageManager::instance.UnlockRange(p, sizeof(T) * n); } std::allocator::deallocate(p, n); @@ -246,7 +247,7 @@ struct zero_after_free_allocator : public std::allocator void deallocate(T* p, std::size_t n) { if (p != NULL) - memset(p, 0, sizeof(T) * n); + OPENSSL_cleanse(p, sizeof(T) * n); std::allocator::deallocate(p, n); } };