summaryrefslogtreecommitdiff
path: root/connectivity/source/parse
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-02-28 12:41:54 +0000
committerCaolán McNamara <caolanm@redhat.com>2022-02-28 17:00:32 +0100
commit42ca32d7a37631dda3fa900ab9f2169234b1f4b3 (patch)
tree92739f59ca8854e10bb86255f78b0d06ba6632ba /connectivity/source/parse
parenta74c51025fa4519caaf461492e4ed8e68bd34885 (diff)
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 <caolanm@redhat.com>
Diffstat (limited to 'connectivity/source/parse')
-rw-r--r--connectivity/source/parse/sqlnode.cxx14
1 files changed, 8 insertions, 6 deletions
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