summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/document_source_union_with.cpp
diff options
context:
space:
mode:
authorNick Zolnierz <nicholas.zolnierz@mongodb.com>2020-09-11 14:36:29 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-09-14 17:34:41 +0000
commitb80b53bde9cfd36fbf2d50e129d123ba8f35df48 (patch)
tree199529bf284302ed3ee4d96b7222a12109f2e45c /src/mongo/db/pipeline/document_source_union_with.cpp
parentec929e17993ade6e0258aab73fd8024d1cb6180f (diff)
downloadmongo-b80b53bde9cfd36fbf2d50e129d123ba8f35df48.tar.gz
SERVER-50895 Fix leak of $unionWith cached pipeline for explain when execution does not read from sub-pipeline
Diffstat (limited to 'src/mongo/db/pipeline/document_source_union_with.cpp')
-rw-r--r--src/mongo/db/pipeline/document_source_union_with.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mongo/db/pipeline/document_source_union_with.cpp b/src/mongo/db/pipeline/document_source_union_with.cpp
index 294b16accc3..3191468d65b 100644
--- a/src/mongo/db/pipeline/document_source_union_with.cpp
+++ b/src/mongo/db/pipeline/document_source_union_with.cpp
@@ -267,7 +267,7 @@ Value DocumentSourceUnionWith::serialize(boost::optional<ExplainOptions::Verbosi
// We've either exhausted the sub-pipeline or at least started iterating it. Use the
// cached pipeline to get the explain output since the '_pipeline' may have been
// modified for any optimizations or pushdowns into the initial $cursor stage.
- pipeCopy = _cachedPipeline;
+ pipeCopy = Pipeline::create(_cachedPipeline, _pipeline->getContext()).release();
} else {
// The plan does not require reading from the sub-pipeline, so just include the
// serialization in the explain output.