diff options
author | Aaron <aaron@10gen.com> | 2012-08-21 15:50:29 -0700 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2012-08-21 16:01:40 -0700 |
commit | 45d66f6b12d8e6faee340c915340256ae1f0a221 (patch) | |
tree | e22786560a0a058319b2c52bfe59455113bdbc5e | |
parent | 089f96e956634cf922fd3dc99681d7f56318502a (diff) | |
download | mongo-45d66f6b12d8e6faee340c915340256ae1f0a221.tar.gz |
SERVER-6757 Store holdCursor in a ClientCursor::Holder to prevent a double free on failed yield recovery.
-rw-r--r-- | src/mongo/db/commands/mr.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp index 5bd4acf6e72..9c46ddc41ab 100644 --- a/src/mongo/db/commands/mr.cpp +++ b/src/mongo/db/commands/mr.cpp @@ -1024,7 +1024,7 @@ namespace mongo { uassert( 16149 , "cannot run map reduce without the js engine", globalScriptEngine ); - auto_ptr<ClientCursor> holdCursor; + ClientCursor::Holder holdCursor; ShardChunkManagerPtr chunkManager; { @@ -1040,8 +1040,8 @@ namespace mongo { // Get a very basic cursor, prevents deletion of migrated data while we m/r shared_ptr<Cursor> temp = NamespaceDetailsTransient::getCursor( config.ns.c_str(), BSONObj(), BSONObj() ); uassert( 15876, str::stream() << "could not create cursor over " << config.ns << " to hold data while prepping m/r", temp.get() ); - holdCursor = auto_ptr<ClientCursor>( new ClientCursor( QueryOption_NoCursorTimeout , temp , config.ns.c_str() ) ); - uassert( 15877, str::stream() << "could not create m/r holding client cursor over " << config.ns, holdCursor.get() ); + holdCursor.reset( new ClientCursor( QueryOption_NoCursorTimeout , temp , config.ns.c_str() ) ); + uassert( 15877, str::stream() << "could not create m/r holding client cursor over " << config.ns, holdCursor ); } @@ -1133,7 +1133,6 @@ namespace mongo { if ( ! yield.stillOk() ) { cursor.release(); - holdCursor.release(); break; } |