summaryrefslogtreecommitdiff
path: root/sal/qa/osl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-31 14:46:38 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-02-01 12:15:22 +0000
commit2489000d3fd66319a8355fd4e37cfdfda47296d0 (patch)
treecaad79e7b5bec3863604b20190b682c0d73d2b25 /sal/qa/osl
parent595848c85acc2609fcc48a40c7a9f216a2722cd8 (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 Change-Id: I3a7a094da543debdcd2374737c2ecff91d644625 Reviewed-on: https://gerrit.libreoffice.org/33749 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sal/qa/osl')
-rw-r--r--sal/qa/osl/process/osl_Thread.cxx10
1 files changed, 3 insertions, 7 deletions
diff --git a/sal/qa/osl/process/osl_Thread.cxx b/sal/qa/osl/process/osl_Thread.cxx
index 58d916e7fe9c..463096e93c8a 100644
--- a/sal/qa/osl/process/osl_Thread.cxx
+++ b/sal/qa/osl/process/osl_Thread.cxx
@@ -28,17 +28,14 @@
// include files
#include <sal/types.h>
-
#include <rtl/string.hxx>
-
#include <rtl/strbuf.hxx>
-
#include <osl/thread.hxx>
-
#include <osl/mutex.hxx>
#include <osl/time.h>
#include <string.h>
+#include <memory>
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
@@ -1694,13 +1691,12 @@ public:
private:
void SAL_CALL run() override
{
- oslThreadIdentifier* pId = new oslThreadIdentifier;
+ std::unique_ptr<oslThreadIdentifier> pId( new oslThreadIdentifier );
*pId = getIdentifier();
- idData.setData(pId);
+ idData.setData(pId.get());
oslThreadIdentifier* pIdData = static_cast<oslThreadIdentifier*>(idData.getData());
//t_print("Thread %d has Data %d\n", getIdentifier(), *pIdData);
m_Id = *pIdData;
- delete pId;
}
public: