Skip to content

Commit 5160984

Browse files
committed
SERVER-6814 - fix memory leak in BtreeCursor::make
1 parent 084125a commit 5160984

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/mongo/db/btreecursor.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,20 +221,20 @@ namespace mongo {
221221
NamespaceDetails *d, int idxNo, const IndexDetails& id,
222222
const BSONObj &startKey, const BSONObj &endKey, bool endKeyInclusive, int direction)
223223
{
224-
BtreeCursor *c = make( d , idxNo , id );
224+
auto_ptr<BtreeCursor> c( make( d , idxNo , id ) );
225225
c->init(startKey,endKey,endKeyInclusive,direction);
226226
c->initWithoutIndependentFieldRanges();
227227
dassert( c->_dups.size() == 0 );
228-
return c;
228+
return c.release();
229229
}
230230

231231
BtreeCursor* BtreeCursor::make(
232232
NamespaceDetails *d, int idxNo, const IndexDetails& id,
233233
const shared_ptr< FieldRangeVector > &bounds, int singleIntervalLimit, int direction )
234234
{
235-
BtreeCursor *c = make( d , idxNo , id );
235+
auto_ptr<BtreeCursor> c( make( d , idxNo , id ) );
236236
c->init(bounds,singleIntervalLimit,direction);
237-
return c;
237+
return c.release();
238238
}
239239

240240
BtreeCursor::BtreeCursor( NamespaceDetails* nsd , int theIndexNo, const IndexDetails& id )

0 commit comments

Comments
 (0)