desktop/source/deployment/misc/lockfile.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
New commits: commit 36a9091ee88ecc0a03235ee144e6babf2f8ef92a Author: Stephan Bergmann <sberg...@redhat.com> Date: Wed Apr 26 17:32:35 2017 +0200 loplugin:useuniqueptr (clang-cl) Change-Id: I08c2c3557b4cb1804446d5a65e8e0499b27a3329 diff --git a/desktop/source/deployment/misc/lockfile.cxx b/desktop/source/deployment/misc/lockfile.cxx index fa30bf256fee..47aa5fb72d2c 100644 --- a/desktop/source/deployment/misc/lockfile.cxx +++ b/desktop/source/deployment/misc/lockfile.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <memory> + #include <stdlib.h> #include <time.h> #ifndef _WIN32 @@ -47,12 +51,11 @@ static OString impl_getHostname() hostname by using the netbios name */ DWORD sz = MAX_COMPUTERNAME_LENGTH + 1; - char* szHost = new char[sz]; - if (GetComputerName(szHost, &sz)) - aHost = OString(szHost); + auto szHost = std::unique_ptr<char[]>(new char[sz]); + if (GetComputerName(szHost.get(), &sz)) + aHost = OString(szHost.get()); else aHost = OString("UNKNOWN"); - delete[] szHost; #else /* Don't do dns lookup on Linux either */ sal_Char pHostName[1024]; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits