diff options
author | weidai <weidai11@users.noreply.github.com> | 2010-06-18 07:06:59 +0000 |
---|---|---|
committer | weidai <weidai11@users.noreply.github.com> | 2010-06-18 07:06:59 +0000 |
commit | d60229a02a18a285b1e25e45c0623b290207cf4c (patch) | |
tree | 2c3909fc3181e50ef34814d62769b02277bc13a5 /smartptr.h | |
parent | b110830c7f9c6d2c6fa257073a8ec7b096df3ea8 (diff) | |
download | cryptopp-git-d60229a02a18a285b1e25e45c0623b290207cf4c.tar.gz |
fix possible race condition in Singleton::Ref()
tolerate double destruction of Singleton and g_nullNameValuePairs
fix #include of standard headers
Diffstat (limited to 'smartptr.h')
-rw-r--r-- | smartptr.h | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -9,8 +9,8 @@ NAMESPACE_BEGIN(CryptoPP) template <class T> class simple_ptr { public: - simple_ptr() : m_p(NULL) {} - ~simple_ptr() {delete m_p;} + simple_ptr(T *p = NULL) : m_p(p) {} + ~simple_ptr() {delete m_p; m_p = NULL;} // set m_p to NULL so double destruction (which might occur in Singleton) will be harmless T *m_p; }; |