summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests/updatetests.cpp
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2014-10-15 15:47:06 -0400
committerAndrew Morrow <acm@mongodb.com>2014-10-15 20:51:31 -0400
commiteb5f7e613c80ae00f2d9a92fbbf4c7548ffc216c (patch)
tree1f295e6e0dfa3dec874e16f3f754aaf2a4bc0bdf /src/mongo/dbtests/updatetests.cpp
parent82c79ceed40f66b4e4c260d4b7d5cef5061893ac (diff)
downloadmongo-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.cpp10
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 {