diff options
author | Jason Rassi <rassi@10gen.com> | 2014-08-19 16:14:46 -0400 |
---|---|---|
committer | Jason Rassi <rassi@10gen.com> | 2014-08-20 14:16:47 -0400 |
commit | 71277e8a5d072fbfa956a74f3c0295f69ead120f (patch) | |
tree | ea7ca0674c85927be0980d24abcb1a5c61930dac /src | |
parent | 562c8cb3faff5e9fc0acdc45db8dc2d498eb2000 (diff) | |
download | mongo-71277e8a5d072fbfa956a74f3c0295f69ead120f.tar.gz |
SERVER-14892 Fix memory leak in MatchExpressionParser::_parseElemMatch
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/matcher/expression_parser.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/mongo/db/matcher/expression_parser.cpp b/src/mongo/db/matcher/expression_parser.cpp index ff82ffbdb79..120c290f6a0 100644 --- a/src/mongo/db/matcher/expression_parser.cpp +++ b/src/mongo/db/matcher/expression_parser.cpp @@ -696,19 +696,20 @@ namespace mongo { // object case - StatusWithMatchExpression sub = _parse( obj, level ); - if ( !sub.isOK() ) - return sub; + StatusWithMatchExpression subRaw = _parse( obj, level ); + if ( !subRaw.isOK() ) + return subRaw; + std::auto_ptr<MatchExpression> sub( subRaw.getValue() ); // $where is not supported under $elemMatch because $where // applies to top-level document, not array elements in a field. - if ( hasNode( sub.getValue(), MatchExpression::WHERE ) ) { + if ( hasNode( sub.get(), MatchExpression::WHERE ) ) { return StatusWithMatchExpression( ErrorCodes::BadValue, "$elemMatch cannot contain $where expression" ); } std::auto_ptr<ElemMatchObjectMatchExpression> temp( new ElemMatchObjectMatchExpression() ); - Status status = temp->init( name, sub.getValue() ); + Status status = temp->init( name, sub.release() ); if ( !status.isOK() ) return StatusWithMatchExpression( status ); |