diff options
author | Andrew Morrow <acm@mongodb.com> | 2014-10-15 15:47:06 -0400 |
---|---|---|
committer | Andrew Morrow <acm@mongodb.com> | 2014-10-15 20:51:31 -0400 |
commit | eb5f7e613c80ae00f2d9a92fbbf4c7548ffc216c (patch) | |
tree | 1f295e6e0dfa3dec874e16f3f754aaf2a4bc0bdf /src/mongo/dbtests/updatetests.cpp | |
parent | 82c79ceed40f66b4e4c260d4b7d5cef5061893ac (diff) | |
download | mongo-eb5f7e613c80ae00f2d9a92fbbf4c7548ffc216c.tar.gz |
SERVER-15641 Fix memory leaks in C++ dbtests
Diffstat (limited to 'src/mongo/dbtests/updatetests.cpp')
-rw-r--r-- | src/mongo/dbtests/updatetests.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mongo/dbtests/updatetests.cpp b/src/mongo/dbtests/updatetests.cpp index 5c67372f2ed..7794238aeb5 100644 --- a/src/mongo/dbtests/updatetests.cpp +++ b/src/mongo/dbtests/updatetests.cpp @@ -45,12 +45,13 @@ namespace UpdateTests { class ClientBase { public: - // NOTE: Not bothering to backup the old error record. ClientBase() : _client(&_txn) { + _prevError = mongo::lastError._get( false ); + mongo::lastError.release(); mongo::lastError.reset( new LastError() ); } - ~ClientBase() { - mongo::lastError.release(); + virtual ~ClientBase() { + mongo::lastError.reset( _prevError ); } protected: @@ -66,6 +67,9 @@ namespace UpdateTests { OperationContextImpl _txn; DBDirectClient _client; + + private: + LastError* _prevError; }; class Fail : public ClientBase { |