sc/source/core/tool/interpr2.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
New commits: commit 737d324c900bc3c89e7d7f955b9b4b6725023679 Author: Mike Kaganski <mike.kagan...@collabora.com> Date: Sat Nov 12 13:14:16 2016 +0300 Aviod memory leak in ScInterpreter::ScIntersect() When one argument is a reference list, and another is a reference, that reference is converted to temporary list. That list used to leak because of missing release. Change-Id: Ic76c9b8769b3a50980cf4d4e3468763b65f21e07 Reviewed-on: https://gerrit.libreoffice.org/30792 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index 62627c3..090e492 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -2379,22 +2379,25 @@ void ScInterpreter::ScIntersect() // Convert a reference to list. const formula::FormulaToken* xt[2] = { x1, x2 }; StackVar sv[2] = { sv1, sv2 }; + // There may only be one reference; the other is necessarily a list + // Ensure converted list proper destruction + std::unique_ptr<formula::FormulaToken> p; for (size_t i=0; i<2; ++i) { if (sv[i] == svSingleRef) { ScComplexRefData aRef; aRef.Ref1 = aRef.Ref2 = *xt[i]->GetSingleRef(); - formula::FormulaToken* p = new ScRefListToken; + p.reset(new ScRefListToken); p->GetRefList()->push_back( aRef); - xt[i] = p; + xt[i] = p.get(); } else if (sv[i] == svDoubleRef) { ScComplexRefData aRef = *xt[i]->GetDoubleRef(); - formula::FormulaToken* p = new ScRefListToken; + p.reset(new ScRefListToken); p->GetRefList()->push_back( aRef); - xt[i] = p; + xt[i] = p.get(); } } x1 = xt[0]; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits