summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Base/SafeAllocator.h')
-rw-r--r--Swiften/Base/SafeAllocator.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/Swiften/Base/SafeAllocator.h b/Swiften/Base/SafeAllocator.h
index f59119e..b01d77d 100644
--- a/Swiften/Base/SafeAllocator.h
+++ b/Swiften/Base/SafeAllocator.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011 Remko Tronçon
+ * Copyright (c) 2011-2013 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
@@ -10,6 +10,8 @@
#include <algorithm>
namespace Swift {
+ void secureZeroMemory(char* memory, size_t numberOfBytes);
+
template<typename T>
class SafeAllocator : public std::allocator<T> {
public:
@@ -23,8 +25,10 @@ namespace Swift {
~SafeAllocator() throw() {}
void deallocate (T* p, size_t num) {
- std::fill(reinterpret_cast<char*>(p), reinterpret_cast<char*>(p + num), 0);
+ secureZeroMemory(reinterpret_cast<char*>(p), num);
std::allocator<T>::deallocate(p, num);
}
+
+ private:
};
}