connectivity/source/parse/sqlnode.cxx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
New commits: commit 42ca32d7a37631dda3fa900ab9f2169234b1f4b3 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Feb 28 12:41:54 2022 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon Feb 28 17:00:32 2022 +0100 cid#1500397 silence Resource leak this reverts commit 1142dc2398de2e2be0e057ecb432ad9c8895313a Date: Sun Feb 27 14:14:18 2022 +0100 cid#1500397: Resource leak with an alternative that hopefully silences coverity and helps show better what is going on Change-Id: Ifb117d65789e80e66419911dbb6b327bdf7ed948 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130707 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx index 1a10526c505e..ed23eeac64c2 100644 --- a/connectivity/source/parse/sqlnode.cxx +++ b/connectivity/source/parse/sqlnode.cxx @@ -1843,10 +1843,11 @@ void OSQLParseNode::disjunctiveNormalForm(OSQLParseNode*& pSearchCondition) OSQLParseNode* pNewRight = nullptr; // cut right from parent - pSearchCondition->removeAt(2); + OSQLParseNode* pOldRight = pSearchCondition->removeAt(2); + assert(pOldRight == pRight); - pNewRight = MakeANDNode(pOr->removeAt(2) ,pRight); - pNewLeft = MakeANDNode(pOr->removeAt(sal_uInt32(0)) ,new OSQLParseNode(*pRight)); + pNewRight = MakeANDNode(pOr->removeAt(2), pOldRight); + pNewLeft = MakeANDNode(pOr->removeAt(sal_uInt32(0)), new OSQLParseNode(*pOldRight)); pNewNode = MakeORNode(pNewLeft,pNewRight); // and append new Node replaceAndReset(pSearchCondition,pNewNode); @@ -1862,10 +1863,11 @@ void OSQLParseNode::disjunctiveNormalForm(OSQLParseNode*& pSearchCondition) OSQLParseNode* pNewRight = nullptr; // cut left from parent - delete pSearchCondition->removeAt(sal_uInt32(0)); + OSQLParseNode* pOldLeft = pSearchCondition->removeAt(sal_uInt32(0)); + assert(pOldLeft == pLeft); - pNewRight = MakeANDNode(pLeft,pOr->removeAt(2)); - pNewLeft = MakeANDNode(new OSQLParseNode(*pLeft),pOr->removeAt(sal_uInt32(0))); + pNewRight = MakeANDNode(pOldLeft, pOr->removeAt(2)); + pNewLeft = MakeANDNode(new OSQLParseNode(*pOldLeft), pOr->removeAt(sal_uInt32(0))); pNewNode = MakeORNode(pNewLeft,pNewRight); // and append new Node