diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-31 14:46:38 +0200 |
---|---|---|
committer | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2017-12-05 08:17:11 -0500 |
commit | 9ca19666511b1d44ba554a70cbbc0c8e2db844c6 (patch) | |
tree | 39a0bd694d2f1cf5d5a67082b85717e5bb2cbef0 /starmath | |
parent | 6346e8c08e789e6aa4f2041fab97ba14419dedd4 (diff) |
loplugin:useuniqueptr extend to check local vars
just the simple and obvious case for now, of a local var being allocated
and deleted inside a single local block, and the delete happening at the
end of the block
Reviewed-on: https://gerrit.libreoffice.org/33749
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
(cherry picked from commit 2489000d3fd66319a8355fd4e37cfdfda47296d0)
Change-Id: I3a7a094da543debdcd2374737c2ecff91d644625
(cherry picked from commit e540ccfb5eb43bd4a3d6920074dce8436720ba8e)
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/source/mathmlexport.cxx | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx index c9a6ca8637da..41cc8a120a74 100644 --- a/starmath/source/mathmlexport.cxx +++ b/starmath/source/mathmlexport.cxx @@ -612,8 +612,8 @@ void SmXMLExport::ExportBinaryHorizontal(const SmNode *pNode, int nLevel) { TG nGroup = pNode->GetToken().nGroup; - SvXMLElementExport* pRow = new SvXMLElementExport(*this, - XML_NAMESPACE_MATH, XML_MROW, true, true); + std::unique_ptr<SvXMLElementExport> pRow( new SvXMLElementExport(*this, + XML_NAMESPACE_MATH, XML_MROW, true, true) ); // Unfold the binary tree structure as long as the nodes are SmBinHorNode // with the same nGroup. This will reduce the number of nested <mrow> @@ -639,8 +639,6 @@ void SmXMLExport::ExportBinaryHorizontal(const SmNode *pNode, int nLevel) s.push(binNode->Symbol()); s.push(binNode->LeftOperand()); } - - delete pRow; } void SmXMLExport::ExportUnaryHorizontal(const SmNode *pNode, int nLevel) @@ -708,8 +706,8 @@ void SmXMLExport::ExportBinaryDiagonal(const SmNode *pNode, int nLevel) { // widebslash // We can not use <mfrac> to a backslash, so just use <mo>\</mo> - SvXMLElementExport *pRow = new SvXMLElementExport(*this, - XML_NAMESPACE_MATH, XML_MROW, true, true); + std::unique_ptr<SvXMLElementExport> pRow( new SvXMLElementExport(*this, + XML_NAMESPACE_MATH, XML_MROW, true, true) ); ExportNodes(pNode->GetSubNode(0), nLevel); @@ -721,8 +719,6 @@ void SmXMLExport::ExportBinaryDiagonal(const SmNode *pNode, int nLevel) } ExportNodes(pNode->GetSubNode(1), nLevel); - - delete pRow; } } |