diff options
author | Eddie Louie <eddie.louie@mongodb.com> | 2017-09-25 23:36:36 -0400 |
---|---|---|
committer | Eddie Louie <eddie.louie@mongodb.com> | 2017-10-04 15:43:31 -0400 |
commit | e329bd234dc00535b36a47ae998cf24a40552968 (patch) | |
tree | 1d0b72ced6910a3b1b6fe4a81a119852efdefe92 /src/mongo/db/query/plan_enumerator.h | |
parent | cea80793198c198fc2819808982ac3d5ef7c1105 (diff) | |
download | mongo-e329bd234dc00535b36a47ae998cf24a40552968.tar.gz |
SERVER-31305 Use smart pointer to prevent memory leak in
QueryPlanner::plan()
Diffstat (limited to 'src/mongo/db/query/plan_enumerator.h')
-rw-r--r-- | src/mongo/db/query/plan_enumerator.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/mongo/db/query/plan_enumerator.h b/src/mongo/db/query/plan_enumerator.h index dbb8403901a..91522d27488 100644 --- a/src/mongo/db/query/plan_enumerator.h +++ b/src/mongo/db/query/plan_enumerator.h @@ -93,12 +93,11 @@ public: Status init(); /** - * Outputs a possible plan. Leaves in the plan are tagged with an index to use. - * Returns true if a plan was outputted, false if no more plans will be outputted. - * - * 'tree' is set to point to the query tree. A QueryAssignment is built from this tree. - * Caller owns the pointer. Note that 'tree' itself points into data owned by the - * provided CanonicalQuery. + * Outputs a possible plan. Leaves in the plan are tagged with an index to use. + * Returns a MatchExpression representing a point in the query tree (which can be + * used to build a QueryAssignment) or nullptr if no more plans will be outputted. + * While owned by the caller, the MatchExpression returned points into data that is + * owned elsewhere. * * Nodes in 'tree' are tagged with indices that should be used to answer the tagged nodes. * Only nodes that have a field name (getCategory() != kLogical) will be tagged. @@ -106,7 +105,7 @@ public: * The output tree is a clone identical to that used to initialize the enumerator, with tags * added in order to indicate index usage. */ - bool getNext(MatchExpression** tree); + std::unique_ptr<MatchExpression> getNext(); private: // |