summaryrefslogtreecommitdiff
path: root/sccomp
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-31 14:46:38 +0200
committerAshod Nakashian <ashod.nakashian@collabora.co.uk>2017-12-05 08:17:11 -0500
commit9ca19666511b1d44ba554a70cbbc0c8e2db844c6 (patch)
tree39a0bd694d2f1cf5d5a67082b85717e5bb2cbef0 /sccomp
parent6346e8c08e789e6aa4f2041fab97ba14419dedd4 (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 'sccomp')
-rw-r--r--sccomp/source/solver/LpsolveSolver.cxx6
1 files changed, 2 insertions, 4 deletions
diff --git a/sccomp/source/solver/LpsolveSolver.cxx b/sccomp/source/solver/LpsolveSolver.cxx
index b07691eae3a4..1e22d991c23d 100644
--- a/sccomp/source/solver/LpsolveSolver.cxx
+++ b/sccomp/source/solver/LpsolveSolver.cxx
@@ -221,7 +221,7 @@ void SAL_CALL LpsolveSolver::solve() throw(uno::RuntimeException, std::exception
table::CellAddress aLeftAddr = maConstraints[nConstrPos].Left;
const std::vector<double>& rLeftCoeff = aCellsHash[aLeftAddr];
- REAL* pValues = new REAL[nVariables+1];
+ std::unique_ptr<REAL[]> pValues(new REAL[nVariables+1] );
pValues[0] = 0.0; // ignored?
for (nVar=0; nVar<nVariables; nVar++)
pValues[nVar+1] = rLeftCoeff[nVar+1];
@@ -250,9 +250,7 @@ void SAL_CALL LpsolveSolver::solve() throw(uno::RuntimeException, std::exception
default:
OSL_FAIL( "unexpected enum type" );
}
- add_constraint( lp, pValues, nConstrType, fRightValue );
-
- delete[] pValues;
+ add_constraint( lp, pValues.get(), nConstrType, fRightValue );
}
}