diff options
author | Benjamin Murphy <benjamin_murphy@me.com> | 2016-04-11 10:37:19 -0400 |
---|---|---|
committer | Benjamin Murphy <benjamin_murphy@me.com> | 2016-04-11 11:54:36 -0400 |
commit | 0a5732f6b65563f9d600578c9101cc2082f117f0 (patch) | |
tree | 69a72f846ea8db27c8b3f9c723cf3035a38c0877 /src/mongo/db/query/canonical_query_test.cpp | |
parent | b8497be45d68fbf643a42d7197eb3abdba4ffc14 (diff) | |
download | mongo-0a5732f6b65563f9d600578c9101cc2082f117f0.tar.gz |
SERVER-21065 Fixed use-after-free in canonical_query_test.cpp.
Diffstat (limited to 'src/mongo/db/query/canonical_query_test.cpp')
-rw-r--r-- | src/mongo/db/query/canonical_query_test.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mongo/db/query/canonical_query_test.cpp b/src/mongo/db/query/canonical_query_test.cpp index bd8f386ea7a..f597fa6e0ce 100644 --- a/src/mongo/db/query/canonical_query_test.cpp +++ b/src/mongo/db/query/canonical_query_test.cpp @@ -617,7 +617,8 @@ TEST(CanonicalQueryTest, NormalizeQueryTree) { } TEST(CanonicalQueryTest, NormalizeWithInPreservesTags) { - unique_ptr<MatchExpression> matchExpression(parseMatchExpression(fromjson("{x: {$in: [1]}}"))); + BSONObj obj = fromjson("{x: {$in: [1]}}"); + unique_ptr<MatchExpression> matchExpression(parseMatchExpression(obj)); matchExpression->setTag(new IndexTag(2U, 1U, false)); matchExpression.reset(CanonicalQuery::normalizeTree(matchExpression.release())); IndexTag* tag = dynamic_cast<IndexTag*>(matchExpression->getTag()); @@ -626,8 +627,8 @@ TEST(CanonicalQueryTest, NormalizeWithInPreservesTags) { } TEST(CanonicalQueryTest, NormalizeWithInAndRegexPreservesTags) { - unique_ptr<MatchExpression> matchExpression( - parseMatchExpression(fromjson("{x: {$in: [/a.b/]}}"))); + BSONObj obj = fromjson("{x: {$in: [/a.b/]}}"); + unique_ptr<MatchExpression> matchExpression(parseMatchExpression(obj)); matchExpression->setTag(new IndexTag(2U, 1U, false)); matchExpression.reset(CanonicalQuery::normalizeTree(matchExpression.release())); IndexTag* tag = dynamic_cast<IndexTag*>(matchExpression->getTag()); |