diff options
author | Charlie Swanson <charlie.swanson@mongodb.com> | 2018-12-19 11:41:59 -0500 |
---|---|---|
committer | Charlie Swanson <charlie.swanson@mongodb.com> | 2018-12-20 14:08:52 -0500 |
commit | 63a529c95e65197227c158667b520ee9777024c5 (patch) | |
tree | 0b884ebcb403a3daabcbe19db7fd388f21a8d469 | |
parent | ef51ce0672dde933164fba1fc4f7ecf53c77b378 (diff) | |
download | mongo-63a529c95e65197227c158667b520ee9777024c5.tar.gz |
Targeted fix for reproduction script for SERVER-38601
The patch for SERVER-35455 did not apply cleanly to this branch so
instead we pursued this more targeted fix for the leak described in
SERVER-38601.
-rw-r--r-- | src/mongo/db/query/planner_access.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/db/query/planner_access.cpp b/src/mongo/db/query/planner_access.cpp index 90c4873ffbb..7be731c0ff9 100644 --- a/src/mongo/db/query/planner_access.cpp +++ b/src/mongo/db/query/planner_access.cpp @@ -723,6 +723,7 @@ bool QueryPlannerAccess::processIndexScans(const CanonicalQuery& query, const std::vector<IndexEntry>& indices, const QueryPlannerParams& params, std::vector<QuerySolutionNode*>* out) { + invariant(out->empty()); // Initialize the ScanBuildingState. ScanBuildingState scanState(root, inArrayOperator, indices); @@ -750,6 +751,9 @@ bool QueryPlannerAccess::processIndexScans(const CanonicalQuery& query, // In most cases this means that we recursively build indexed data // access on 'child'. if (!processIndexScansSubnode(query, &scanState, params, out)) { + for (auto& soln : *out) { + delete soln; // Clean up any partial solutions. + } return false; } continue; |