From 2b6381e5149be830b4d241c68554cebe5cac4b83 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Thu, 10 Jan 2019 18:34:17 -0800 Subject: [PATCH] Use secure allocator for RNG state --- src/random.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/random.cpp b/src/random.cpp index 2bc0282996880..784b2813d9d66 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -20,6 +20,8 @@ #include #include +#include "allocators.h" + #ifndef WIN32 #include #endif @@ -351,8 +353,8 @@ RNGState& GetRNGState() noexcept { // This C++11 idiom relies on the guarantee that static variable are initialized // on first call, even when multiple parallel calls are permitted. - static std::unique_ptr g_rng{new RNGState()}; - return *g_rng; + static std::vector> g_rng(1); + return g_rng[0]; } }