diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-31 14:46:38 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-01 12:15:22 +0000 |
commit | 2489000d3fd66319a8355fd4e37cfdfda47296d0 (patch) | |
tree | caad79e7b5bec3863604b20190b682c0d73d2b25 /registry/source/regimpl.cxx | |
parent | 595848c85acc2609fcc48a40c7a9f216a2722cd8 (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 'registry/source/regimpl.cxx')
-rw-r--r-- | registry/source/regimpl.cxx | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx index 6f684e12ef83..c6ea42c6169a 100644 --- a/registry/source/regimpl.cxx +++ b/registry/source/regimpl.cxx @@ -1483,12 +1483,11 @@ RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_ sal::static_int_cast< unsigned long >(valueSize)); fprintf(stdout, "%s Data = ", indent); - sal_Unicode* value = new sal_Unicode[size]; - readString(pBuffer, value, size); + std::unique_ptr<sal_Unicode[]> value(new sal_Unicode[size]); + readString(pBuffer, value.get(), size); - OString uStr = OUStringToOString(value, RTL_TEXTENCODING_UTF8); + OString uStr = OUStringToOString(value.get(), RTL_TEXTENCODING_UTF8); fprintf(stdout, "L\"%s\"\n", uStr.getStr()); - delete[] value; } break; case RegValueType::BINARY: |