summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/sbe
diff options
context:
space:
mode:
authorMatt Boros <matt.boros@mongodb.com>2022-12-09 02:13:45 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-12-09 02:47:25 +0000
commited586f19b9aa22ad7d0482141b453c107fd20ee6 (patch)
treeb913c8f084d658c0b51e1cee79b6ea5344a44487 /src/mongo/db/exec/sbe
parent62645f45955ace58e70b9cbbcb31d9b9f984cb56 (diff)
downloadmongo-ed586f19b9aa22ad7d0482141b453c107fd20ee6.tar.gz
SERVER-71977 Fix memory leak in Sorted Merge sbe_abt_test
Diffstat (limited to 'src/mongo/db/exec/sbe')
-rw-r--r--src/mongo/db/exec/sbe/abt/sbe_abt_test.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/db/exec/sbe/abt/sbe_abt_test.cpp b/src/mongo/db/exec/sbe/abt/sbe_abt_test.cpp
index 8758ae83786..f74d395d00c 100644
--- a/src/mongo/db/exec/sbe/abt/sbe_abt_test.cpp
+++ b/src/mongo/db/exec/sbe/abt/sbe_abt_test.cpp
@@ -504,6 +504,11 @@ TEST_F(NodeSBE, Lower2) {
UnionNode* unionNode = unionABT.cast<UnionNode>();
ABT& ixScanABT = unionNode->nodes().front().cast<EvaluationNode>()->getChild();
std::swap(unionABT, ixScanABT);
+ // Swap the right leaf of the MergeJoin with Blackhole, so that it can be deleted. Without
+ // this it points to the IndexScan and cannot delete, since the IndexScan still exists under
+ // the new SortedMerge.
+ ABT blackHole = make<Blackhole>();
+ std::swap(unionNode->nodes().front().cast<EvaluationNode>()->getChild(), blackHole);
// Swap out the MergeJoin for SortedMerge.
ABT sortedMergeABT =